-
Notifications
You must be signed in to change notification settings - Fork 34
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
Potential race condition in closures #23
Comments
The problem here is that when doing
query2 is executed when the connection is in the middle of reading the results of query1, i.e. the call to PQgetResult(connection) still gets the next row of query1 even in the second callback for result2.asResultSet.nextRow(). We have to decide what to do in such situations, when we are in the middle of fetching results and receive an 'execute' call with another query. We can either kill the first query fetcher, or don't execute the second query and return an error for it. The branch issue_23 contains the first option. It adds a state to |
The fix has been merged in #45 and tagged |
Context: a very large postgresql db (> 100k hits per query), a function that queries for the existence of 2 conditions, then inserts data if the conditions aren't met.
Expected result: no error, insertion
Actual result: no error (TUPLE_OK from the pq lib, successNoData from Kuery), no insertion
More details:
the basic layout of the code was:
What did work was putting the insert on a separate connection from the pool.
After a conversation with @shmuelk, I opened this issue, but I'm aware of the difficulties reproducing such a bug with access to my exact setup.
The text was updated successfully, but these errors were encountered: