near / near-jsonrpc-client-rs

Lower-level API for interfacing with the NEAR Protocol via JSONRPC.
https://docs.rs/near-jsonrpc-client
Apache License 2.0
47 stars 43 forks source link

panicked at 'dispatch dropped without returning error' with hyper #106

Closed Borwe closed 2 years ago

Borwe commented 2 years ago

I get this error: panicked at 'dispatch dropped without returning error', /home/brian/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.20/src/client/conn.rs:329:35

when I do call JsonRpcClient::call(), it happens at random, not always constant. Checking around seems I get this similar issue posted on hyper's github https://github.com/hyperium/hyper/issues/2892, they recommend making the client shareable, also this other project has similar issues: https://github.com/ydb-platform/ydb-rs-sdk/issues/92

Borwe commented 2 years ago

The repo I use that causes: https://github.com/Borwe/near-exchanges Running the tests individually doesn't cause this problem for some reason.

miraclx commented 2 years ago

Hi there, so here's the thing. If you're dealing with multiple runtimes, you should not use the same JsonRpcClient connector. So, swap out JsonRpcClient::connect which uses a default, global connector for a manual connector.

- JsonRpcClient::connect(URL);
+ let connector = JsonRpcClient::new_client();
+ let client = connector.connect(URL);

If this helps you, feel free to close the issue.

miraclx commented 2 years ago

@Borwe, please let me know if this helps you. Otherwise, I'll be closing this issue in 4 days if there's no update.

miraclx commented 2 years ago

Closed. Feel free to reopen if you think your issue is unresolved.