This commit is contained in:
Dylan Conway
2026-02-13 23:58:37 -08:00
parent f7767b4f43
commit 67964b85fe
2 changed files with 9 additions and 2 deletions

View File

@@ -592,6 +592,13 @@ pub fn deinit(dev: *DevServer) void {
if (s.underlying) |websocket|
websocket.close();
}
// Drain pending libuv close callbacks before freeing memory.
// libuv closes handles asynchronously — without this, close
// callbacks reference freed socket memory
if (bun.Environment.isWindows) {
const uv_loop = bun.windows.libuv.Loop.get();
_ = bun.windows.libuv.uv_run(uv_loop, .nowait);
}
dev.active_websocket_connections.deinit(alloc);
},

View File

@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
import { bunEnv, bunExe } from "harness";
import { bunEnv, bunExe, isWindows } from "harness";
// Regression test for use-after-poison in builtin OutputTask callbacks
// inside command substitution $().
@@ -14,7 +14,7 @@ import { bunEnv, bunExe } from "harness";
// with many /tmp entries and some permission-denied dirs reliably
// triggers the ASAN use-after-poison.
describe("builtins in command substitution with errors should not crash", () => {
describe.skipIf(isWindows)("builtins in command substitution with errors should not crash", () => {
test("ls /tmp/* in command substitution", async () => {
await using proc = Bun.spawn({
cmd: [