-
Notifications
You must be signed in to change notification settings - Fork 29
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
apoc.cypher.runTimeboxed throws "DatabaseException: The transaction has been closed" #82
Comments
Comment by tolomaus Some more details I discovered along the way: It turns out that my actual cypher query still contained some logic that is not supported anymore in neo4j 4.x, like Now that these issues are fixed the runTimeboxed seems to work fine again. The reason why this query works and not the trivial one above is that in my actual query I collect the results in a map. So the following query works fine:
So the issue may already exist in neo4j 3.x. It would be good to include an optional flag to the runTimeboxed procedure to not swallow any errors. This would cover errors due to bad queries but also the timeout error. Sending an empty (or partial) result when the timeout is hit is not an option in my use case. |
Comment by tolomaus see also #1233 |
Comment by sarmbruster Hi @tolomaus ,
To solve this, you need to rebind the node:
Using the Does that explanation solve the issue for you? |
Comment by tolomaus Hi @sarmbruster thanks for the clear explanation! The proposed solution feels a bit complicated though, especially if several collections of nodes and/or entities are returned from the query. I guess it may probably also generate a performance hit since all items need to be retrieved again by id. Luckily for me, as explained above, I only return maps from the timeboxed queries so far and these don't seem to be impacted by the issue. This timeboxing feature is essential for the availability and stability of my platform since it is very hard to estimate upfront how much time a query will take. I'm guaranteed that no query will abuse the whole database for longer than a couple of seconds. I'm perfectly happy with a simple all or nothing approach: if the timeout is hit then I dont show any results. Partial results are not meaningful in my case. With that in mind, I wonder if it would make sense for me to stick with the original runTimeboxed implementation of killing the main transaction when the timeout is hit? see https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/800dc4283e324ca119513e7ce97ddd0fad3941bb/src/main/java/apoc/cypher/Timeboxed.java |
Comment by sarmbruster Let me double check if it's possible to prevent using a separate transaction. |
Comment by tolomaus Sure happy to help |
There have been a lot changes here in the last 4 years, and like mentioned there is another timebox related issue that is open about improving the erroring, so I will close this one :) |
Issue by tolomaus
Saturday Sep 05, 2020 at 16:21 GMT
Originally opened as neo4j-contrib/neo4j-apoc-procedures#1652
Hi, I'm migrating my graph db from neo4j 3.5 to 4.1 but it looks like the apoc.cypher.runTimeboxed procedure is broken:
I used a clean install of neo4j 4.1.1 + apoc 4.1.0.2 on both centos and mac and even spun up a neo4j Aura instance, all giving the same result.
The test only checks if the result count is higher than zero: https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/16581f3253f82e75506428dfd2a498346c6bfb1d/core/src/test/java/apoc/cypher/CypherTest.java#L180 maybe it doesnt need to hit the database again for this.
See also the following result:
so it looks like all five of the results are correctly found. Since I only want an non-existing property x it just returns NULLs and doesnt have to hit the database neither so avoiding the above error.
The text was updated successfully, but these errors were encountered: