neo4jrb / neo4j-ruby-driver

Neo4j Ruby Driver
MIT License
39 stars 29 forks source link

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

Open worldnamer opened 1 week ago

worldnamer commented 1 week ago

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 commented 3 days ago

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.