Discard writes made to an aborted uWS response by OxleyS · Pull Request #682 · socketio/engine.io

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behaviour

This bug only exists for polling transport connections running on top of uWS.
If the remote client abruptly disconnects (thus aborting the request) while the server is waiting on an asynchronous operation such as compression, the server may attempt to write a response via the aborted response object. This causes an uncaught exception to be thrown.

New behaviour

Attempts to write to or finalize the aborted response object are now silently discarded instead. While checking for an aborted response at the writing call site is also an option, I feel this approach is both the least likely to regress down the road, and that the desired behavior would be the same in any case.