Fix process abort when a server PING arrives during connection teardown#461
Open
marekl11 wants to merge 1 commit into
Open
Fix process abort when a server PING arrives during connection teardown#461marekl11 wants to merge 1 commit into
marekl11 wants to merge 1 commit into
Conversation
getnamo
requested changes
Jun 19, 2026
getnamo
left a comment
Owner
There was a problem hiding this comment.
fix without try/catch. This is avoided in unreal modules in general.
on_ping() replied to server PINGs with the throwing websocketpp send overload, unlike send_impl()/ping() which use the non-throwing error_code overload and guard on con_opened. If a PING lands while the connection is tearing down, websocketpp throws (invalid_state/bad_connection) on the asio network thread, which run_loop() did not catch, so it propagated to std::terminate -> abort and killed the whole process. Seen under connect/disconnect churn (reconnects, level transitions) in a packaged UE5 build. on_ping() now mirrors send_impl()/ping(): only send when con_opened and use the error_code overload. run_loop() additionally wraps m_client.run() in a try/catch so no stray handler exception can ever take the process down.
d2b23ff to
6d1d3fd
Compare
Contributor
Author
|
Good point! dropped the try/catch. The PR is now just the on_ping change: send the PONG only when con_opened, via the non-throwing error_code overload (same pattern as send_impl()/ping()). That stops the throw at the source, so nothing escapes the io thread and the catch isn't needed. Force-pushed the revised commit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
on_ping() replied to server PINGs with the throwing websocketpp send overload, unlike send_impl()/ping() which use the non-throwing error_code overload and guard on con_opened. If a PING lands while the connection is tearing down, websocketpp throws (invalid_state/bad_connection) on the asio network thread, which run_loop() did not catch, so it propagated to std::terminate -> abort and killed the whole process. Seen under connect/disconnect churn (reconnects, level transitions) in a packaged UE5 build.
on_ping() now mirrors send_impl()/ping(): only send when con_opened and use the error_code overload. run_loop() additionally wraps m_client.run() in a try/catch so no stray handler exception can ever take the process down.