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

ws-server: Handle soketto::Incoming::Closed frames #815

Merged
merged 4 commits into from
Jul 6, 2022

Conversation

lexnv
Copy link
Contributor

@lexnv lexnv commented Jul 6, 2022

Ensure that incoming Closed frames are not ignored.

This PR captures the close reason for the connection when detected by the receiver.

While at it, the WS error log line was polluting internal metrics when clients disconnected suddenly. Have changed it from warning to debug.

Logs

  • obtained with a custom client that closes its sender part in the background_task
2022-07-06T15:21:18.739200Z TRACE soketto::connection: e0000f78: recv, incoming CLOSE: CloseReason { code: 1000, descr: Some("") }
2022-07-06T15:21:18.739225Z DEBUG jsonrpsee_ws_server::server: WS transport: remote peer terminated the connection: 1

Closes #813 .

@lexnv lexnv requested a review from a team as a code owner July 6, 2022 12:06
@lexnv lexnv self-assigned this Jul 6, 2022
Copy link
Member

@niklasad1 niklasad1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great but I think one of the logs is sufficient.

what about removing https://github.com/paritytech/jsonrpsee/blob/master/ws-server/src/server.rs#L407?

@lexnv
Copy link
Contributor Author

lexnv commented Jul 6, 2022

Have removed the close reason log instead. I was able to force the MonitoredError::Selector(SokettoError::Closed) code-path with multiple client requests and dropped connection, without triggering the soketto::Incoming::Closed path. The close reason is also printed by soketto for trace-level logs.

ws-server/src/server.rs Outdated Show resolved Hide resolved
@niklasad1 niklasad1 merged commit 3b4829d into master Jul 6, 2022
@niklasad1 niklasad1 deleted the 813_clean_close_ws branch July 6, 2022 16:27
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 this pull request may close these issues.

[ws server]: clean shutdown on soketto::Incoming::Closed(reason)
3 participants