-
Notifications
You must be signed in to change notification settings - Fork 39
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
Bad state: Cannot write to socket, it is closed on query close #44
Comments
I've encountered an additional variation of this, when running this code:
This produces:
Which is similar to above, but you can see that this one is failing on a read, rather than a write. These errors are preventing me from managing the connection in my application, though I am also wondering if I am doing it wrong. My app is set up as an http server that creates a new connectionpool object for each request. I did this after noting that one global pool object wasn't playing nice when I tried to perform additional requests while a long-running request was running (sorry I don't have the message it used to give me, I changed and moved on). One pool per request resolved this issue, but that means I have to deliberately manage all queries and pools, but these errors are making that quite difficult. Is there a mistake in my understanding? |
So, I switched back to one global pool in my project after figuring out the issue I was having with concurrent connections (I opened another ticket for what I discovered there), so this is not as important to me now. I did also find you documentation where you state that calling close on the pool is dangerous, thought I think that making query.close a future so that we can wait for it to finish is a good idea. |
I am getting this exception when I close the pool very soon after closing a query:
the issue seems to be that the query close fires of a Future internally, so the close() function returns before the close is actually finished:
The pool close happens immediately, it closes the socket right away. This means the query close (which is delayed till after the pool close due to the Future) fails, unable to send whatever information it needs to through the socket. I think the query close either needs to be changed to return a Future that doesn't complete until the query is actually closed, or the query close needs to be changed to be able to deal with the closed socket.
Code to replicate the issue:
The text was updated successfully, but these errors were encountered: