-
Notifications
You must be signed in to change notification settings - Fork 318
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I don't have a minimal reproduction yet, but I wanted to report this issue anyways.
Basically what I'm trying to do is insert 100,000 of entries into a database as a transaction with rollback in case I have a data mapping issue in between.
My code is roughly:
console.log("tx begin");
await sql.begin("READ WRITE", async (tsql) => {
await Promise.all([...].map(async (x) => {
console.log("insert begin");
await tsql`insert into table ${x}`;
console.log("insert end");
}));
console.log("tx end"
});
console.log("await end");
The output I get is:
tx begin
insert begin
insert end
...
insert begin
✨ Done in 102.00s.
I started looking a bit inside the begin implementation, inside scope, this promise never resolves or rejects.
result = await new Promise((resolve, reject) => {
const x = fn(sql)
Promise.resolve(Array.isArray(x) ? Promise.all(x) : x).then(resolve, reject)
})
On my postgres server I get the following error in the log:
[info] postgres | 2023-08-10 00:36:57.064 UTC [14596] LOG: unexpected EOF on client connection with an open transaction
The interesting part here is that the promise seemingly just stops executing and then the process exits. I wonder if this is a load balancing issue on my postgres server, will need to investigate more. In any case I would expect at least a client side error message.
wwelder, daviddanialy, tronikelis and thupi
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working