Skip to content

Commit

Permalink
Reproduction test for the two-transaction timeout issue. (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos authored Sep 6, 2024
1 parent 0f42816 commit 750bcaf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/timeout_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,22 @@ void main() {
expect(Future.delayed(Duration(seconds: 2)), completes);
});
});

// Note: to fix this, we may consider cancelling the currently running statements:
// https://www.postgresql.org/docs/current/protocol-flow.html#PROTOCOL-FLOW-CANCELING-REQUESTS
// withPostgresServer('timeout race conditions', (server) {
// test('two transactions for update', () async {
// final c1 = await server.newConnection();
// final c2 = await server.newConnection();
// await c1.execute('CREATE TABLE t (id INT PRIMARY KEY);');
// await c1.execute('INSERT INTO t (id) values (1);');
// await c1.execute('BEGIN');
// await c1.execute('SELECT * FROM t WHERE id=1 FOR UPDATE');
// await c2.execute('BEGIN');
// await c2.execute('SELECT * FROM t WHERE id=1 FOR UPDATE',
// timeout: Duration(seconds: 1));
// await c1.execute('ROLLBACK');
// await c2.execute('ROLLBACK');
// });
// });
}

0 comments on commit 750bcaf

Please sign in to comment.