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

Occasional panick when closing ws connection in CLI #1308

Closed
Kailai-Wang opened this issue May 19, 2023 · 5 comments · Fixed by #1320
Closed

Occasional panick when closing ws connection in CLI #1308

Kailai-Wang opened this issue May 19, 2023 · 5 comments · Fixed by #1320

Comments

@Kailai-Wang
Copy link
Contributor

We notice in our CI that sometimes direct_api.close().unwrap() panicks:

integritee-indirect-invocation-demo  | [2023-05-15T12:59:06Z DEBUG itc_rpc_client::ws_client] Closing connection
integritee-indirect-invocation-demo  | [2023-05-15T12:59:06Z DEBUG itc_rpc_client::ws_client] Connection is closed
integritee-indirect-invocation-demo  | [2023-05-15T12:59:06Z DEBUG integritee_cli::trusted_operation] do watch is false, closing connection
integritee-indirect-invocation-demo  | [2023-05-15T12:59:06Z DEBUG itc_rpc_client::ws_client] Web-socket close
integritee-indirect-invocation-demo  | [2023-05-15T12:59:06Z DEBUG itc_rpc_client::ws_client] Closing connection
integritee-indirect-invocation-demo  | thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: WsClientError(WS Error <Queue(Disconnected)>)', cli/src/trusted_operation.rs:245:44
integritee-indirect-invocation-demo  | note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
integritee-indirect-invocation-demo  | [2023-05-15T12:59:06Z DEBUG itc_rpc_client::ws_client] Closing connection
integritee-indirect-invocation-demo  | [2023-05-15T12:59:06Z ERROR itc_rpc_client::direct_client] Failed to close web-socket connection: WsClientError(WS Error <Queue(Disconnected)>)
Aborting on container exit...

The status was InSidechainBlock with do_watch = false.

Btw do we have any reason not returning None after the connection is closed here?

direct_api.close().unwrap();

@higherordertech
Copy link

faced same error too

@clangenb
Copy link
Contributor

Hmm, if I read the code correctly, I would say that the missing return Ok(None) could actually be the reason for the panic if the worker sends something before the connection is closed on the worker side, but after we called direct_api.close().unwrap() in the client. Then, we will try to close it twice and panic.

@Kailai-Wang
Copy link
Contributor Author

Yes it can be. It only fails sometimes though, so it can be a timing issue.

@Kailai-Wang
Copy link
Contributor Author

So I submit a minor PR to add the missing return?

@clangenb
Copy link
Contributor

Sure! Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants