You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cargo tree | grep tokio
└── tokio v1.12.0
└── tokio-macros v1.5.0 (proc-macro)
Platform
$ uname -a
Linux exuberant-witness 5.14.12-zen1-1-zen #1 ZEN SMP PREEMPT Wed, 13 Oct 2021 16:58:18 +0000 x86_64 GNU/Linux
Description
I found a possible unsoundness using miri while writing a lock-based concurrent hashmap. This is the minimum example I was able to isolate:
When running env MIRIFLAGS="-Zmiri-disable-isolation" cargo +nightly miri run i get this output:
error: Undefined Behavior: trying to reborrow for SharedReadOnly at alloc24055+0x48, but parent tag <68276> does not have an appropriate item in the borrow stack
--> src/main.rs:20:73
|
20 | RwLockReadGuard::try_map(self.inner.read().await, |map| map.get(key)).ok()
| ^^^ trying to reborrow for SharedReadOnly at alloc24055+0x48, but parent tag <68276> does not have an appropriate item in the borrow stack
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
= note: inside closure at src/main.rs:20:73
It definitely isn't related to #3344. That issue got fixed.
Anyway, my guess is that this isn't the RwLock, but simply that async/await syntax is unsound under the stacked borrows model. See rust-lang/rust#63818 for more info.
Version
$ cargo tree | grep tokio └── tokio v1.12.0 └── tokio-macros v1.5.0 (proc-macro)
Platform
$ uname -a Linux exuberant-witness 5.14.12-zen1-1-zen #1 ZEN SMP PREEMPT Wed, 13 Oct 2021 16:58:18 +0000 x86_64 GNU/Linux
Description
I found a possible unsoundness using
miri
while writing a lock-based concurrent hashmap. This is the minimum example I was able to isolate:When running
env MIRIFLAGS="-Zmiri-disable-isolation" cargo +nightly miri run
i get this output:I wonder is this is related to #3344
The text was updated successfully, but these errors were encountered: