You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the following code to test, there is a certain probability of problems. (使用以下代码测试, 有一定概率出现问题)
import*aspostgresfrom'https://deno.land/x/[email protected]/mod.ts';constpool2=newpostgres.Pool(databaseUrl,2,true);Deno.test('pool-error',async()=>{constp1=(async()=>{constc=awaitpool2.connect();console.log('p1',c.connected);try{constt=c.createTransaction('p1-t');awaitt.begin();t.queryArray(`INSERT INTO test_table ("at") VALUES ($1);`,[newDate().toString()+'p1'],);thrownewError('some error');}finally{c.release();}})().catch((err)=>{console.error('p1',err);});constp2=(async()=>{constc=awaitpool2.connect();console.log('p2',c.connected);try{constt=c.createTransaction('p2-t');awaitt.begin();t.queryArray(`INSERT INTO test_table ("at") VALUES ($1);`,[newDate().toString()+'p2'],);awaitt.commit();}finally{c.release();}})().catch((err)=>{console.error('p2',err);});try{awaitPromise.all([p1,p2]);}finally{awaitpool2.end();}});
The error info is: (出现的错误为)
BadResource: Bad resource ID
rr = await this.rd.read(this.buf);
^
at async read (deno:ext/net/01_net.js:24:19)
at async BufReader.read (https://deno.land/[email protected]/io/buffer.ts:383:12)
at async BufReader.readFull (https://deno.land/[email protected]/io/buffer.ts:415:20)
at async Connection.#readMessage (https://deno.land/x/[email protected]/connection/connection.ts:152:5)
at async Connection.#preparedQuery (https://deno.land/x/[email protected]/connection/connection.ts:853:27)
at async Connection.query (https://deno.land/x/[email protected]/connection/connection.ts:930:16)
at async Transaction.queryArray (https://deno.land/x/[email protected]/query/transaction.ts:413:14)
This problem does not occur if catch (err) { await t.rollback(); throw err; } is done in the above code.
The text was updated successfully, but these errors were encountered:
Use the following code to test, there is a certain probability of problems. (使用以下代码测试, 有一定概率出现问题)
The error info is: (出现的错误为)
This problem does not occur if
catch (err) { await t.rollback(); throw err; }
is done in the above code.The text was updated successfully, but these errors were encountered: