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

can't call foreign function: kqueue #2603

Closed
jjant opened this issue Oct 18, 2022 · 4 comments
Closed

can't call foreign function: kqueue #2603

jjant opened this issue Oct 18, 2022 · 4 comments

Comments

@jjant
Copy link

jjant commented Oct 18, 2022

I tried running miri test in smithy-rs and I run into the following error:

test auth::tests::async_map_request_apply_populates_credentials ... error: unsupported operation: can't call foreign function: kqueue
   --> /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.4/src/sys/unix/selector/kqueue.rs:66:9
    |
66  |         syscall!(kqueue())
    |         ^^^^^^^^^^^^^^^^^^ can't call foreign function: kqueue
    |
    = 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: BACKTRACE:
    = note: inside `mio::sys::unix::selector::kqueue::Selector::new` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.4/src/sys/unix/mod.rs:7:28
    = note: inside `mio::poll::Poll::new` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.4/src/poll.rs:294:13
    = note: inside `tokio::runtime::io::Driver::new` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.1/src/runtime/io/mod.rs:113:20
    = note: inside `tokio::runtime::driver::create_io_stack` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.1/src/runtime/driver.rs:22:29
    = note: inside `tokio::runtime::driver::Driver::new` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.1/src/runtime/driver.rs:170:52
    = note: inside `tokio::runtime::Builder::build_current_thread_runtime` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.1/src/runtime/builder.rs:837:35
    = note: inside `tokio::runtime::Builder::build` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.1/src/runtime/builder.rs:628:36
note: inside `auth::tests::async_map_request_apply_populates_credentials` at aws-http/src/auth.rs:195:9
   --> aws-http/src/auth.rs:195:9
    |
195 | /         assert!(
196 | |             req.properties().get::<Credentials>().is_some(),
197 | |             "it should set credentials on the request config"
198 | |         );
    | |__________^
note: inside closure at aws-http/src/auth.rs:185:11
   --> aws-http/src/auth.rs:185:11
    |
184 |       #[tokio::test]
    |       -------------- in this procedural macro expansion
185 |       async fn async_map_request_apply_populates_credentials() {
    |  ___________^
186 | |         let mut req = operation::Request::new(http::Request::new(SdkBody::from("some body")));
187 | |         set_provider(
188 | |             &mut req.properties_mut(),
...   |
198 | |         );
199 | |     }
    | |_____^
    = note: this error originates in the macro `syscall` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

I'd opened a similar issue in Mio, tokio-rs/mio#1623, but it looks like here's the best place to post it.

@oli-obk
Copy link
Contributor

oli-obk commented Oct 18, 2022

Are you running on macos by any chance? We're currently building tokio support under linux, which uses epoll instead of kqueue. You can try this by using a linux target (miri can interpret all supported targets from any host)

@jjant
Copy link
Author

jjant commented Oct 18, 2022

Hey @oli-obk thanks for the help, I've ran the same command with --target x86_64-unknown-linux-gnu and I get a similar error for epoll_create1:

test routing::awsjson_tests::simple_routing ... error: unsupported operation: can't call foreign function: epoll_create1
   --> /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.4/src/sys/unix/selector/epoll.rs:34:9
    |
34  |         syscall!(epoll_create1(flag)).map(|ep| Selector {
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: epoll_create1
    |
    = 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: BACKTRACE:
    = note: inside `mio::sys::unix::selector::epoll::Selector::new` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.4/src/sys/unix/mod.rs:7:28
    = note: inside `mio::poll::Poll::new` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.4/src/poll.rs:294:13
    = note: inside `tokio::runtime::io::Driver::new` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/io/mod.rs:113:20
    = note: inside `tokio::runtime::driver::create_io_stack` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/driver.rs:22:29
    = note: inside `tokio::runtime::driver::Driver::new` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/driver.rs:170:52
    = note: inside `tokio::runtime::Builder::build_current_thread_runtime` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/builder.rs:837:35
    = note: inside `tokio::runtime::Builder::build` at /Users/jjantdev/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/builder.rs:628:36
note: inside `routing::awsjson_tests::simple_routing` at aws-smithy-http-server/src/routing/mod.rs:559:9

@oli-obk
Copy link
Contributor

oli-obk commented Oct 18, 2022

Wonderful. Your issue is essentially a duplicate of #602 even though your use case is Mac. Not sure we'll ever support Mac, but if we will, we'll first finish the ongoing linux impl.

I'm going to close this issue and we can revisit once everything works on linux

@oli-obk oli-obk closed this as completed Oct 18, 2022
@jjant
Copy link
Author

jjant commented Oct 18, 2022

I see, thank you!

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

No branches or pull requests

2 participants