Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCockroachdb unimplemented feature multiple active portals not supported #580
Comments
I have uploaded a minimal working example here: https://gist.github.com/nagylzs/acc716982f8a8213cbe5d6d6495e5387 |
Some more info: if I don't start a new transaction ( async with conn.transaction() ) then it works. |
Coud it be related to this issue from Cockroach cockroachdb/cockroach#42912? |
It could be. Then it would mean that fetchval or execute did not close the resultset before returning the result? (I'm guessing - these are the only two queries opened.) |
From my analysis, Cockroach is unable to implicitly close a result set (named also portal) in a transaction which it should do if it was respecting completely PSQL spec. As far as I understand, they are not willing to fix this anytime soon because it would require them to do a lot of refactoring and only a few clients are behaving like asyncpg. In this example:
I'm working on a fix (for asyncpg) |
Example code:
The table_exists method looks like this:
This code is actually called from tornado.ioloop.IOLoop.current().run_sync so it is guaranteed that nothing else is running queries concurrently.
Here is the traceback that I'm getting:
The referenced issue tells that it is not possible to keep multiple queries open and fetch from them interleaved.
However, I'm not doing anything that should result in opening multiple queries and fetching from them that way. As far as I see, my code should not open a new query before closing the previous one.
I suspect that asyncpg itself forgot to close something in the background.