Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miri does not support parking_lot (requires futexes: syscall ID 202) #1562

Closed
ralpha opened this issue Sep 26, 2020 · 5 comments · Fixed by #1568
Closed

miri does not support parking_lot (requires futexes: syscall ID 202) #1562

ralpha opened this issue Sep 26, 2020 · 5 comments · Fixed by #1568
Labels
A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement

Comments

@ralpha
Copy link

ralpha commented Sep 26, 2020

I'm testing out miri on my codebase. (So not very familiar with it)
Given this is much higher level then some small library, so did not expect it to work 2nd try.
This test failed because of unsupported operation: miri does not support syscall ID 202.
It was trying to connect to a SQLite database (via Diesel).

let mut builder = r2d2::Pool::builder();
let pool_result = builder.build(manager); // <<---Error from here

Maybe you can do something with this info.
So call is going: MyApplication -> (diesel ->) r2d2 -> parking_lot -> parking_lot_core -> Error

error: unsupported operation: miri does not support syscall ID 202
   --> /home/username/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/parking_lot_core-0.8.0/src/thread_parker/linux.rs:112:13
    |
112 | /             libc::syscall(
113 | |                 libc::SYS_futex,
114 | |                 &self.futex,
115 | |                 libc::FUTEX_WAIT | libc::FUTEX_PRIVATE_FLAG,
116 | |                 1,
117 | |                 ts_ptr,
118 | |             )
    | |_____________^ miri does not support syscall ID 202
    |
    = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
            
    = note: inside `parking_lot_core::thread_parker::imp::ThreadParker::futex_wait` at /home/username/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/parking_lot_core-0.8.0/src/thread_parker/linux.rs:112:13
    = note: inside `<parking_lot_core::thread_parker::imp::ThreadParker as parking_lot_core::thread_parker::ThreadParkerT>::park_until` at /home/username/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/parking_lot_core-0.8.0/src/thread_parker/linux.rs:87:13
    = note: inside closure at /home/username/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/parking_lot_core-0.8.0/src/parking_lot.rs:650:30
    = note: inside `parking_lot_core::parking_lot::with_thread_data::<parking_lot_core::parking_lot::ParkResult, [closure@parking_lot_core::parking_lot::park::{{closure}}#0 0:&usize, 1:[closure@parking_lot::condvar::Condvar::wait_until_internal::{{closure}}#0 0:&&parking_lot::condvar::Condvar, 1:&*mut parking_lot::raw_mutex::RawMutex, 2:&mut bool], 2:&std::option::Option<std::time::Instant>, 3:&parking_lot_core::parking_lot::ParkToken, 4:[closure@parking_lot::condvar::Condvar::wait_until_internal::{{closure}}#1 0:&&parking_lot::raw_mutex::RawMutex], 5:[closure@parking_lot::condvar::Condvar::wait_until_internal::{{closure}}#2 0:&usize, 1:&mut bool, 2:&&parking_lot::condvar::Condvar]]>` at /home/username/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/parking_lot_core-0.8.0/src/parking_lot.rs:224:5
    = note: inside `parking_lot_core::parking_lot::park::<[closure@parking_lot::condvar::Condvar::wait_until_internal::{{closure}}#0 0:&&parking_lot::condvar::Condvar, 1:&*mut parking_lot::raw_mutex::RawMutex, 2:&mut bool], [closure@parking_lot::condvar::Condvar::wait_until_internal::{{closure}}#1 0:&&parking_lot::raw_mutex::RawMutex], [closure@parking_lot::condvar::Condvar::wait_until_internal::{{closure}}#2 0:&usize, 1:&mut bool, 2:&&parking_lot::condvar::Condvar]>` at /home/username/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/parking_lot_core-0.8.0/src/parking_lot.rs:617:5
    = note: inside `parking_lot::condvar::Condvar::wait_until_internal` at /home/username/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/parking_lot-0.11.0/src/condvar.rs:338:26
    = note: inside `parking_lot::condvar::Condvar::wait_until::<r2d2::PoolInternals<diesel::sqlite::connection::SqliteConnection>>` at /home/username/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/parking_lot-0.11.0/src/condvar.rs:292:9
    = note: inside `r2d2::Pool::<diesel::r2d2::ConnectionManager<diesel::sqlite::connection::SqliteConnection>>::wait_for_initialization` at /home/username/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/r2d2-0.8.9/src/lib.rs:398:16
    = note: inside `r2d2::config::Builder::<diesel::r2d2::ConnectionManager<diesel::sqlite::connection::SqliteConnection>>::build` at /home/username/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/r2d2-0.8.9/src/config.rs:228:9

For now I'll be adding #[cfg_attr(miri, ignore)].

@oli-obk
Copy link
Contributor

oli-obk commented Sep 27, 2020

we don't support network connections yet at all. We should look into supporting parking_lot though, that seems like a good first step

@RalfJung
Copy link
Member

SQLite doesn't need a network connection I think, usually applications open the DB files directly.

But yeah, looks like for parking_lot we'll need to implement futexes.

@RalfJung RalfJung changed the title miri does not support syscall ID 202 miri does not support parking_lot (requires futexes: syscall ID 202) Sep 27, 2020
@RalfJung RalfJung added A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-medium E-good-first-issue A good way to start contributing, mentoring is available and removed E-medium labels Sep 27, 2020
@RalfJung
Copy link
Member

RalfJung commented Oct 1, 2020

Looks like Miri now needs this even for the standard library due to rust-lang/rust#76919 (Cc rust-lang/rust#77406).

@m-ou-se said they would work on it; let me know if you need any help!

@RalfJung RalfJung added E-medium and removed E-good-first-issue A good way to start contributing, mentoring is available labels Oct 2, 2020
@bors bors closed this as completed in b0e02f0 Oct 3, 2020
@bors bors closed this as completed in #1568 Oct 3, 2020
@ralpha
Copy link
Author

ralpha commented Oct 3, 2020

I have to say, this was resolved very quick! Great work! @m-ou-se @RalfJung

@RalfJung
Copy link
Member

RalfJung commented Oct 3, 2020

You were quite lucky, the standard library started using futexes so there was a lot of pressure to get them working. ;) Then @m-ou-se went above what the standard library needed and also got parking_lot to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants