Skip to content

Improve handling of client disconnection#56

Merged
funmaker merged 1 commit intofunmaker:masterfrom
LilianBoulard:fix-client-disconnection-handling
Jan 19, 2026
Merged

Improve handling of client disconnection#56
funmaker merged 1 commit intofunmaker:masterfrom
LilianBoulard:fix-client-disconnection-handling

Conversation

@LilianBoulard
Copy link
Contributor

I often get this kind of error logs on main:

Error: Request aborted
  at onaborted (/app/node_modules/express/lib/response.js:1052:15)
  at Immediate.<anonymous> (/app/node_modules/express/lib/response.js:1094:9)
  at processImmediate (node:internal/timers:483:21) {
    code: 'ECONNABORTED'
  }
  Error: Cannot set headers after they are sent to the client
  at ServerResponse.setHeader (node:_http_outgoing:655:11)
  at ServerResponse.header (/app/node_modules/express/lib/response.js:794:10)
  at ServerResponse.react (/build/server/middlewares/reactMiddleware.tsx:64:9)
  at /build/server/app.ts:50:20
  at Layer.handle_error (/app/node_modules/express/lib/router/layer.js:71:5)
  at trim_prefix (/app/node_modules/express/lib/router/index.js:326:13)
  at /app/node_modules/express/lib/router/index.js:286:9
  at Function.process_params (/app/node_modules/express/lib/router/index.js:346:12)
  at next (/app/node_modules/express/lib/router/index.js:280:10)
  at Layer.handle_error (/app/node_modules/express/lib/router/layer.js:67:12)

This PR fixes that by better handling ECONNABORTED and already-sent requests headers.

I've tested it for about an hour and didn't see those kind of logs anymore.

@funmaker
Copy link
Owner

LGTM

@funmaker funmaker merged commit 626bf53 into funmaker:master Jan 19, 2026
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.

2 participants