Skip to content

Conversation

@brianc
Copy link
Owner

@brianc brianc commented Jun 4, 2024

Since the pg-native tests run more now the race condition is more apparent. In CI I think the query doesn't have time to get to the backend sometimes before the cancel is executed. This should give it more time. Still somewhat of a race condition possible, but much less likely. Also removed unneeded non-dev dependency in pg-native.

@brianc brianc merged commit 7fcf941 into master Jun 4, 2024
@brianc brianc deleted the bmc/improve-race-condition-in-pg-native-test branch June 4, 2024 16:39
var client = new Client()
client.connectSync()
client.query('SELECT pg_sleep(100);', function (err) {
client.query('SELECT pg_sleep(1000);', function (err) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The arg to pg_sleep(...) is seconds so changing from 100 to 1000 would not be relevant.

I think what you need to do is raise the 100 milliseconds (not seconds) below on line 16 to give the DB more time to start this command. The race that's happening is that the query has not started before 100ms, not that it's not running for long enough.

@brianc
Copy link
Owner Author

brianc commented Jun 5, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants