Neo4j::Driver::Exceptions::ServiceUnavailableException
error, 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!
require 'active_graph/railtie'
Rake::Task['neo4j:start'].invoke('test')
Rake::Task['neo4j:start'].reenable
Timeout.timeout(120) do
sleep 1 while `curl localhost:7575 > /dev/null 2>&1 ; echo $?`.chomp != "0"
end
ActiveGraph::Base.query("Match (n:ModelVersion) return n.version").entries
Rake::Task['neo4j:stop'].invoke('test')
Rake::Task['neo4j:start'].invoke('test')
Timeout.timeout(120) do
sleep 1 while `curl localhost:7575 > /dev/null 2>&1 ; echo $?`.chomp != "0"
end
tried_before = false
begin
ActiveGraph::Base.query("Match (n:ModelVersion) return n.version").entries
rescue Neo4j::Driver::Exceptions::SessionExpiredException
puts 'Got SessionExpiredException'
raise if tried_before
tried_before = true
retry
end
puts ActiveGraph::Base.query("Match (n:ModelVersion) return n.version").entries.length
ActiveGraph::Base.driver = nil
after start. You will still need to wait for the server to start. Open question: why is the driver initialized before server start? Are you making any queries before? Ideally the stale connection should be purged and new one created. This is working in the java based drivers 1.7 and 4.1, but seems not to be on the seabolt based driver 1.7.
$ jruby -S rails generate scaffold User name:string email:string
2020-11-13T11:37:59.585-05:00 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=org.jruby.dist --add-opens java.base/java.io=org.jruby.dist' to enable.
2020-11-13T11:38:03.555-05:00 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=org.jruby.dist --add-opens java.base/java.io=org.jruby.dist' to enable.
invoke active_graph
identical app/models/user.rb
ArgumentError: Can not transliterate strings with Windows-1252 encoding
transliterate at D:/jruby-9.2.13.0/lib/ruby/gems/shared/gems/activesupport-6.0.3.4/lib/active_support/inflector/transliterate.rb:67
parameterize at D:/jruby-9.2.13.0/lib/ruby/gems/shared/gems/activesupport-6.0.3.4/lib/active_support/inflector/transliterate.rb:123
parameterize at D:/jruby-9.2.13.0/lib/ruby/gems/shared/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/inflections.rb:196
base_migration_file_name at D:/jruby-9.2.13.0/lib/ruby/gems/shared/gems/activegraph-10.0.1/lib/rails/generators/active_graph_generator.rb:15
migration_file_name at D:/jruby-9.2.13.0/lib/ruby/gems/shared/gems/activegraph-10.0.1/lib/rails/generators/active_graph_generator.rb:19
migration_template at D:/jruby-9.2.13.0/lib/ruby/gems/shared/gems/activegraph-10.0.1/lib/rails/generators/active_graph_generator.rb:40
create_model_file at D:/jruby-9.2.13.0/lib/ruby/gems/shared/gems/activegraph-10.0.1/lib/rails/generators/active_graph/model/model_generator.rb:21
run at D:/jruby-9.2.13.0/lib/ruby/gems/shared/gems/thor-1.0.1/lib/thor/command.rb:27
invoke_command at D:/jruby-9.2.13.0/lib/ruby/gems/shared/gems/thor-1.0.1/lib/thor/invocation.rb:127
invoke_all at D:/jruby-9.2.13.0/lib/ruby/gems/shared/gems/thor-1.0.1/lib/thor/invocation.rb:134
each at org/jruby/RubyHash.java:1415
map at org/jruby/RubyEnumerable.java:886
invoke_all at D:/jruby-9.2.13.0/lib/ruby/gem
RUN apt-get install -y wget
RUN wget https://github.com/neo4j-drivers/seabolt/releases/download/v1.7.4/seabolt-1.7.4-Linux-ubuntu-18.04.deb
RUN dpkg -i seabolt-1.7.4-Linux-ubuntu-18.04.deb
RUN rm seabolt-1.7.4-Linux-ubuntu-18.04.deb
included do
around_action :wrap_in_session_or_transaction
end
def wrap_in_session_or_transaction
ActiveGraph::Base.session(bookmarks: transaction_bookmarks) do
wrap_in_transaction? ? ActiveGraph::Base.send(transaction_method) { yield } : yield
end
@last_bookmark = serialize_bk(ActiveGraph::Base.last_bookmark)
auth_token_headers
end
transaction_method
is read_transaction
or write_transaction
. You need to specify this correctly to get the full benefit of causal cluster.
Hi. We have an array field in our nodes and I want to search by this field.
If I do Node.where(ar: [1, 2, 3])
the query is ... WHERE n.ar IN $ar...
, how can I use the equality operator =
instead of IN
?
I tried making a custom type with a custom converter where to_db
returned an array, but even then the query used IN
but not =
.
Anyone else using Neo4j Aura with ActiveGraph? I got an email today saying:
"It seem you are using a Ruby driver (we believe via http://neo4jrb.io/ ) to connect to Aura and as you know unfortunately this driver is not part of the official Neo4j supported drivers certified to work well with Aura.
Note that this driver https://github.com/neo4jrb/activegraph#neo4j-version-support states that support for 4.1 and above are not supported and since Aura is running 4.2+ this is indeed an issue."
Anyone else got this?