Skip to content

Conversation

@Hywan
Copy link
Member

@Hywan Hywan commented Sep 15, 2025

@Hywan Hywan force-pushed the feat-cross-process-lock-poisoning branch from 3c168ad to 976f768 Compare September 16, 2025 09:22
@codecov
Copy link

codecov bot commented Sep 16, 2025

Codecov Report

❌ Patch coverage is 86.85446% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.49%. Comparing base (c3e01a6) to head (884d726).
⚠️ Report is 23 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/matrix-sdk-common/src/cross_process_lock.rs 80.89% 10 Missing and 7 partials ⚠️
crates/matrix-sdk-sqlite/src/crypto_store.rs 88.88% 1 Missing and 2 partials ⚠️
crates/matrix-sdk-sqlite/src/event_cache_store.rs 88.00% 1 Missing and 2 partials ⚠️
crates/matrix-sdk-sqlite/src/media_store.rs 88.00% 1 Missing and 2 partials ⚠️
crates/matrix-sdk/src/encryption/mod.rs 50.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5672      +/-   ##
==========================================
- Coverage   88.50%   88.49%   -0.01%     
==========================================
  Files         360      360              
  Lines      100723   100819      +96     
  Branches   100723   100819      +96     
==========================================
+ Hits        89145    89222      +77     
- Misses       7395     7409      +14     
- Partials     4183     4188       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 16, 2025

CodSpeed Performance Report

Merging #5672 will not alter performance

Comparing Hywan:feat-cross-process-lock-poisoning (884d726) with main (ee82861)

Summary

✅ 50 untouched

@Hywan Hywan force-pushed the feat-cross-process-lock-poisoning branch 3 times, most recently from 39b6f56 to b29747d Compare September 16, 2025 16:33
@Hywan Hywan force-pushed the feat-cross-process-lock-poisoning branch 5 times, most recently from 891db14 to 985032c Compare September 26, 2025 12:51
@Hywan Hywan changed the title feat(common): Add cross-process lock poison feat(common): Add cross-process lock dirtying Sep 26, 2025
@Hywan Hywan force-pushed the feat-cross-process-lock-poisoning branch from f1d3407 to 9a87ac6 Compare October 29, 2025 14:07
Hywan added 2 commits October 31, 2025 11:50
This patch adds `CrossProcessLockGeneration`. A lock generation is an
integer incremented each time the lock is taken by another holder. If
the generation changes, it means the lock is _dirtied_. This _dirtying_
aspect is going to be expanded in the next patches. This patch focuses
on the introduction of this _generation_.

The `CrossProcessLock::try_lock_once` method, and
the `TryLock::try_lock` method, both returns a
`Option<CrossProcessLockGeneration>` instead of a `bool`: `true` is
replaced by `Some(_)`, `false` by `None`.
@Hywan Hywan force-pushed the feat-cross-process-lock-poisoning branch 3 times, most recently from f2bd5ec to 1889f8c Compare October 31, 2025 14:39
Hywan added 2 commits October 31, 2025 15:52
…cache stores.

This patch adds `Lease::generation` support in the crypto, media and
event cache stores.

For the crypto store, we add the new `lease_locks` object store/table.
Previously, `Lease` was stored in `core`, but without any prefix, it's
easy to overwrite another records, it's dangerous. The sad thing is
that it's hard to delete the existing leases in `core` because the keys
aren't known. See the comment in the code explaining the tradeoff.

For media and event cache stores, the already existing `leases` object
store/table is cleared so that we can change the format of `Lease`
easily.
This patch detects when the cross-process lock has been dirtied.

A new `CrossProcessLockResult` enum is introduced to simplify the
returned value of `try_lock_once` and `spin_lock`. It flattens the
previous `Result<Option<_>>` by providing 3 variants: `Clean`, `Dirty`
and `Unobtained`.
@Hywan Hywan force-pushed the feat-cross-process-lock-poisoning branch from 1889f8c to 884d726 Compare October 31, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant