diff --git a/src/bun.js/api/bun/socket.zig b/src/bun.js/api/bun/socket.zig index 23e28c773e..4e85baf2b3 100644 --- a/src/bun.js/api/bun/socket.zig +++ b/src/bun.js/api/bun/socket.zig @@ -1296,7 +1296,7 @@ fn NewSocket(comptime ssl: bool) type { ) void { JSC.markBinding(@src()); log("onTimeout", .{}); - if (this.detached) return; + if (this.detached or this.socket.isShutdown() or this.socket.isClosed()) return; const handlers = this.handlers; const callback = handlers.onTimeout;