Files
bun.sh/test/js/sql/socket.fail.fixture.ts
Ciro Spaciari 258a2a2e3a fix(postgres) memory fix when connection fails sync (#21616)
### What does this PR do?
We should not call .deinit() after .toJS otherwise hasPendingActivity
will access invalid memory

### How did you verify your code works?
Test run it with debug build on macos or asan on and will catch it

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-04 19:41:20 -07:00

20 lines
397 B
TypeScript

setTimeout(() => {
// no need to wait we know at this point that the test passed
process.exit(0);
}, 100);
for (let i = 0; i < 3; i++) {
try {
const sql = new Bun.SQL({
url: "postgres://-invalid-:1234/postgres",
max: 1,
idleTimeout: 1,
connectionTimeout: 1,
maxLifetime: 1,
});
await sql.connect();
} catch {
} finally {
Bun.gc(true);
}
}