MATCHqueries seem okay — but
CREATEqueries cause errors
That's not true — it's the MATCH query it fails on:
ActiveGraph::Base.query("MATCH (n:ModelVersion) DELETE n")
(no changes, no records)which is as expected
MATCH (n:ModelVersion) DELETE nand
MATCH (n:ModelVersion) RETURN nseemed to work just fine
`` Neo4j::Driver::Exceptions::SessionExpiredException: code:fff
, error_context:plain_socket_send(/tmp/seabolt-20201020-8099-19eti4h/seabolt-1.7.4/src/seabolt/src/bolt/communication-plain.c:231), send error code: 32
close' /Users/stephenbetts/.gem/jruby/2.5.7/gems/neo4j-ruby-driver-1.7.2/lib/neo4j/driver/auto_closable.rb:21:inblock in begin_transaction'
run_transaction_work' /Users/stephenbetts/.gem/jruby/2.5.7/gems/activegraph-10.0.1/lib/active_graph/transactions.rb:38:inblock in send_transaction'
block in session' /Users/stephenbetts/.gem/jruby/2.5.7/gems/activegraph-10.0.1/lib/active_graph/transactions.rb:37:insend_transaction'
block in <main>' /Users/stephenbetts/WiP/nypl/subject-headings-explorer-poc/lib/tasks/graph.rake:86:inblock in <main>'
start' /Users/stephenbetts/.gem/jruby/2.5.7/gems/bundler-2.1.4/exe/bundle:46:inblock in <main>'
neo4j-java-driverdriver working, but in the meantime I have a theory. The rake task I'm working on stops and starts the local test neo4j server. I wonder if the connection that ActiveGraph::Base.query uses has expired. Is there a way to reconnect (in the old neo4jrb I was establishing the connection directly with
Neo4j::Core::CypherSession.newwith the suitable adaptor — that seems different now)
Hi, I'm in the process of transitioning to ActiveGraph. I have the following piece of code that needs to be converted:
q = ::Neo4j::Core::Query.new(session: ::Neo4j::ActiveBase.current_session)
I tried using:
q = ::ActiveGraph::Base.query
But I'm getting the following error:
Traceback (most recent call last): 2: from (irb):13 1: from (irb):14:in `rescue in irb_binding' ArgumentError (Could not determine query from arguments: )
Rake::Task['neo4j:start'].invoke(environment) sleep 20 tried_before = false begin ActiveGraph::Base.query("Match (n:ModelVersion) return n.version").entries rescue Neo4j::Driver::Exceptions::SessionExpiredException raise if tried_before tried_before = true retry end
Neo4j::Driver::Exceptions::ServiceUnavailableExceptionerror, not the session expired one. Also I have increased that sleep to 5 minutes for testing, with no difference. Finally, you can see that going from a failed query to a successful one is virtually instantaneous — there is no additional sleep statement. If the problem was that the sleep wasn't long enough I'd expect the 2nd query to fail sometimes, but I've never seen that.
I modified the code above to be (not an exact copy, but close enough) to
Rake::Task['neo4j:start'].invoke(environment) sleep 1 while `curl localhost:7575 > /dev/null 2>&1 ; echo $?`.chomp != "0" tried_before = false begin ActiveGraph::Base.query("Match (n:ModelVersion) return n.version").entries rescue Neo4j::Driver::Exceptions::SessionExpiredException puts "retrying" raise if tried_before tried_before = true retry end
and I see the "retrying" output, exactly once and everything is fine after that.
As far as I'm concerned this is an okay workaround for now, so I'm mostly just posting here for your information, not to obtain an immediate fix. Thanks!