Open e3dio opened 9 months ago
Version: Deno 1.40.4
server.shutdown() should wait for websockets to close to prevent leaking serverWebSocket, abort() should force close websockets
server.shutdown()
serverWebSocket
const port = 3006; Deno.test('httpServerWebSocketShutdown', async t => { const wsOpen = Promise.withResolvers(); const server = Deno.serve({ port }, req => { const { socket, response } = Deno.upgradeWebSocket(req); socket.onopen = wsOpen.resolve; return response; }); const ws = new WebSocket(`ws://localhost:${port}`); await wsOpen.promise; await server.shutdown(); });
error: Leaking resources: serverWebSocket
Thank you for the report. I think we should probably wait for all WS connections to drain on shutdown, and terminate forcefully on abort.
Version: Deno 1.40.4
server.shutdown()
should wait for websockets to close to prevent leakingserverWebSocket
, abort() should force close websockets