Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproduction test for the two-transaction timeout issue. #362

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
// });
// });
}
Loading