Skip to content
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

Nested transaction hangs #213

Open
petergebala opened this issue Nov 7, 2022 · 2 comments
Open

Nested transaction hangs #213

petergebala opened this issue Nov 7, 2022 · 2 comments

Comments

@petergebala
Copy link
Contributor

I have a weird issue. Our code hangs whenever we try:
Example:

ActiveRecord::Base.transaction do
  ActiveGraph::Base.write_transaction do
     User.first # User is an ActiveRecord object. Hangs here
  end
end

From my investigation looks like it hangs inside Async gem and the only other gem that is using it is neo4j-ruby-driver.

Ruby: 3.1
Rails: 7.0.4
Neo4j version 4.4.0.12
Neo4j ruby driver version: 4.4.0.beta-1

@klobuczek
Copy link
Member

@petergebala that's an interesting issue. However, neo4j does not support nested transactions not to mention nested with within different database transactions.
One thing to note is that the block provided to write_transaction runs as a transaction function that is subject to retries. So the code within the block must be idempotent which is another reason why what you attempt is difficult to achieve.
Now we are intrigued about the reason for the hang but do not have enough time to research the rather academic question.

@petergebala
Copy link
Contributor Author

Thanks for the reply @klobuczek.

To give you some context. Currently, we are using neo4j 3.5 with ruby 2.7 and rails 6.1. We want to migrate to a newer version of neo4j - 4.4. That forces us to upgrade ruby (3.1) and rails (7.0.x). Existing code base (neo4j 3.5, older driver, code with nested transactions) works just fine and as expected. So for me, it looks like regression over past versions. Transactions are useful to keep data in sync between different DBs. Also, it sounds dangerous that ActiveGraph affects in some way ActiveRecord.

Of course, above example was just a simplification of the logic that we have. It does not matter if we put there write_transaction or read_transaction. What is more code inside the block doesn't raise any error (It is simple select).

We will try to debug this issue, but it will take probably more time for us. We are not familiar with the driver code base yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants