-
Notifications
You must be signed in to change notification settings - Fork 163
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
Concurrent use of portals and simple queries invalidates portals #553
Comments
Thanks for this, I'll do some experiments and update the doc as needed. |
By the way you can add |
related document which specifies this behavior:
|
I was trying to capture server communication itself to see if other clients behaviors are different, but it turns out to be fruitless 😄 |
I suspect Im hitting this or a related problem. Im trying to do a bunch of bulk inserts. When I do them serially with |
I would need to see some code I guess, but it sounds like you need to operate inside a transaction if you want to have multiple active portals. |
Thanks for the pointer, issue solved :) I added a session pool and ran each of my parallel insert jobs in a separate session & transaction. Stable and very fast! 🏎️ |
Don't the Postgres docs indicate the prepared statement should be good for the life of the connection?
I don't know. Reading through their docs I don't get a clear session of whether session = tx or session = connection. |
I still get this randomly even inside explicit transactions. I'm not doing anything parallel as far as I can tell. Will try to experiment with debug to see if I can reproduce. |
@matthughes From what I remember, the word session in pg docs is used broadly, and in this case, the term refers to a live transaction.
It's probably an implicit failure in the transactions. e.g. a merging two streams together. |
Here's an example log showcasing the failure. I have a service that obtains a session, opens a transaction and does a session.prepare call. I hit this service in parallel to exhibit the behavior. I believe this is showing the two transactions communication intermingled.
|
This UNLISTEN right after the BindComplete looks wrong but it's hard to know since this (I believe) is messages from two different connections being interspersed. Is there a relatively easy way to add some sort of connection identifier to the debug log? Or can we somehow use MessageSocket.history in an error message so we can replay the last N failed logs before a failure? |
Note that turning commandCache = 0 makes this problem go away. |
Ok I finally found what was causing the issue in my code and was able to reproduce in Skunk PR. Seems calling .flatMap(identity) or .flatten "outside" of session/tx resource acquisition causes this problem. I don't know if that's a bug in Skunk or a bug in CE or just a bug in my understanding. |
Hi, we have hit the same problem. we have something like this
getStuffFromDb1 and getStuffFromDb2 goes to db and streams some data from here and there:
when using parJoinUnbounded we had the same portal_X closed. so did using queryCache = 0 |
To reproduce:
This will fail with exception Problem: Portal "portal_2" does not exist.
From what is seen on tcpdump and wireshark, Portal get invalidated implicitly and server takes it as a given and not sends any message for its invalidation.
expected behavior:
This is hard to say, as it is exactly what postgres do which is inconvenient IMO, but this is issue can be mitigated by warnings on document, method docs etc.
The text was updated successfully, but these errors were encountered: