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

No results returned, even though query is executed on server #234

Open
worldnamer opened this issue Nov 17, 2024 · 8 comments
Open

No results returned, even though query is executed on server #234

worldnamer opened this issue Nov 17, 2024 · 8 comments

Comments

@worldnamer
Copy link

Hi!

I created a bare ruby project using Bundler 2.5.23 on Ruby 3.3.6 with the neo4j-ruby-driver as the sole gem in the project. The Gemfile.lock says the version being used is 4.4.5. After bundle install, I then created a test file that contained the following:

require 'logger'
require 'neo4j/driver'

logger = Logger.new(STDOUT)
driver = Neo4j::Driver::GraphDatabase.driver("bolt://172.17.112.1:7687", Neo4j::Driver::AuthTokens.basic('neo4j', 'passwordformydatabase'), logger: logger)
session = driver.session(database: 'neo4j')
session.read_transaction do |tx|
  puts tx.run('RETURN 1 AS one').to_a;
end

The output of this was as follows:

I, [2024-11-17T02:58:57.426760 #4642]  INFO -- : Direct driver instance 2060 created for server address 172.17.112.1:7687
D, [2024-11-17T02:58:57.426946 #4642] DEBUG -- : Acquiring a connection from pool towards 172.17.112.1:7687
D, [2024-11-17T02:58:57.430042 #4642] DEBUG -- : S: [Bolt Handshake] 4.4
D, [2024-11-17T02:58:57.430164 #4642] DEBUG -- : C: HELLO {:scheme=>"basic", :principal=>"neo4j", :credentials=>"******", :user_agent=>"neo4j-ruby/4.4.5"}
D, [2024-11-17T02:58:57.432378 #4642] DEBUG -- : S: SUCCESS {:server=>"Neo4j/5.24.0", :connection_id=>"bolt-9", :hints=>{:"connection.recv_timeout_seconds"=>120}}
D, [2024-11-17T02:58:57.432445 #4642] DEBUG -- : Channel 2160 acquired
D, [2024-11-17T02:58:57.432517 #4642] DEBUG -- : C: BEGIN {:mode=>"r", :db=>"neo4j"}
D, [2024-11-17T02:58:57.434357 #4642] DEBUG -- : S: SUCCESS {}
D, [2024-11-17T02:58:57.434475 #4642] DEBUG -- : C: RUN "RETURN 1 AS one" {} {}
D, [2024-11-17T02:58:57.434533 #4642] DEBUG -- : C: PULL {:n=>1000}
D, [2024-11-17T02:58:57.436492 #4642] DEBUG -- : S: SUCCESS {:t_first=>1, :fields=>["one"], :qid=>0}
D, [2024-11-17T02:58:57.437734 #4642] DEBUG -- : S: RECORD [1]
D, [2024-11-17T02:58:57.437802 #4642] DEBUG -- : S: SUCCESS {:type=>"r", :t_last=>1, :db=>"neo4j"}
D, [2024-11-17T02:58:57.437890 #4642] DEBUG -- : C: COMMIT
D, [2024-11-17T02:58:57.438858 #4642] DEBUG -- : S: SUCCESS {:bookmark=>"FB:kcwQlvymRhkKSyqCmdfx5xRtkhOQ"}
D, [2024-11-17T02:58:57.438929 #4642] DEBUG -- : C: RESET
D, [2024-11-17T02:58:57.439483 #4642] DEBUG -- : S: SUCCESS {}
D, [2024-11-17T02:58:57.439529 #4642] DEBUG -- : Channel 2160 released.

The query was sent to the database, executed, returned with the correct result to the driver, and then those results were eaten.

In case this matters, I ran this on Ubuntu 24.04.1 LTS under WSL, and the Neo4J Desktop under Windows itself. I got similar results running this against an Aura instance. Replacing the .to_a with calls to .single.first causes the NoSuchRecordException. I can run cypher-shell against the DB and get the expected results, so I'm fairly confident the issue is within the driver itself, but I have no idea how to troubleshoot it. Any thoughts?

@worldnamer
Copy link
Author

Just checking in on this. The python driver for neo4j is working under the same conditions (able to read and write), so I'm convinced the issue is with the ruby driver specifically. Happy to check any details that might be useful to check, but I simplified the use-case as much as I could think to do.

@fanktom
Copy link

fanktom commented Dec 9, 2024

We can reproduce this.

@klobuczek
Copy link
Member

Sorry, I'm slammed with work. Could you guys try earlier ruby versions to see if the problem is still present? We have not tested ruby 3.3 very much.

@geisonbiazus
Copy link

I'm also having this problem. I tried with different versions of the gem dependencies and the problem seems to be with the async-io gem. Version 1.31.0 seems to work. From 1.32.0 upwards doesn't. Something might have changed the dependency API or behavior.

@worldnamer
Copy link
Author

I did try this on Ruby 2.7.8 and it seemed to work; hopefully this just requires a library version patch. :)

@klobuczek
Copy link
Member

Ruby 2.7.8 is a surprise because ruby >= 3.1 is a hard requirement for MRI driver 4.4.

@worldnamer
Copy link
Author

worldnamer commented Dec 10, 2024

To be fair, my test is extremely basic, though I share your surprise. I can do a more thorough search of where things start to break down tomorrow. :) I may have overstated my success after seeing the connection, but I'll get more info as soon as I can.

@geisonbiazus
Copy link

For me, it works with ruby 3.3.6 and async-io 1.31.0

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

4 participants