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

Use error handling callback in more places, emit 1015 when WSS TLS handshaking fails, micro-optimize ServerWebSocket, fix bug in util.inspect exceptions #10633

Merged
merged 12 commits into from
Apr 29, 2024

Conversation

Jarred-Sumner
Copy link
Collaborator

What does this PR do?

  • Prepare for Get Sentry-like error reporting working #5091 by swapping almost all usages of vm.runErrorHandler to vm.onError which calls the currently registered error handler instead of the global one. This may cause test failures, we will see.
  • Shrink ServerWebSocket struct size from 28 bytes -> 24 bytes, which should slightly improve performance (rounding to alignment it was probably 32 bytes before)
  • Micro-optimize console.log on objects which implement util.inspect.custom by caching the structure. This was barely measurable, might not be worth it
  • Fixes a bug where throwing while logging a custom inspect would print [native code] because it was not correctly checking for exceptions
  • This adds a test for onConnectError and fixes a double free there. Fixes windows client websocket on error event causes crash #10619.
  • WebSocket now emits close code 1015 for TLS handshaking failure (cc @cirospaciari). Browsers do not do this. But on a server, this is useful information (image from the websocket spec).
image

Along the way, noticed a bug with unhandled errors. We seem to continue executing in cases where we should not continue executing. I think it's simple to fix, but it is very much a breaking change until we do #5091

How did you verify your code works?

There are tests

@Jarred-Sumner Jarred-Sumner requested review from a team, dylan-conway and cirospaciari and removed request for a team April 29, 2024 09:57
Copy link
Contributor

github-actions bot commented Apr 29, 2024

@Jarred-Sumner, your commit has failing tests :(

💪 4 failing tests Darwin AARCH64

💻 1 failing tests Darwin x64 baseline

💻 3 failing tests Darwin x64

🐧💪 2 failing tests Linux AARCH64

🐧🖥 1 failing tests Linux x64 baseline

🪟💻 8 failing tests Windows x64 baseline

🪟💻 7 failing tests Windows x64

View logs

{
// LOG(Network, "WebSocket %p didReceiveErrorMessage()", this);
// queueTaskKeepingObjectAlive(*this, TaskSource::WebSocket, [this, reason = WTFMove(reason)] {
if (m_state == CLOSED)
return;
const bool wasConnecting = m_state == CONNECTING;
Copy link
Collaborator

@dylan-conway dylan-conway Apr 29, 2024

Choose a reason for hiding this comment

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

can't this be isConnectionError when the function is called instead?

 didReceiveClose(CleanStatus::NotClean, 1006, message, m_state == CONNECTING);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no, see the next line

@Jarred-Sumner Jarred-Sumner merged commit 3970339 into main Apr 29, 2024
45 of 52 checks passed
@Jarred-Sumner Jarred-Sumner deleted the jarred/error-handling branch April 29, 2024 20:57
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.

windows client websocket on error event causes crash
3 participants