Skip to content

Commit 4d0640d

Browse files
Skn0ttCopilot
andcommitted
fix(fetch): comment keep-alive socket error listener cleanup
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 5cd1c251-bdcb-4f5f-b9a6-17ed643d095e
1 parent cd80df6 commit 4d0640d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • packages/playwright-core/src/server

‎packages/playwright-core/src/server/fetch.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,10 @@ export abstract class APIRequestContext extends SdkObject {
600600
serverPort = socket.remotePort;
601601

602602
socket.on('error', handleRequestError);
603+
// Keep-alive sockets outlive the request - drop our listener so they do not
604+
// pile up. If the socket is already destroyed (server reset after refusing the
605+
// body), keep it: a late write EPIPE can still fire, and the listener dies with
606+
// the socket anyway.
603607
request.once('close', () => {
604608
if (!socket.destroyed)
605609
socket.off('error', handleRequestError);

0 commit comments

Comments
 (0)