maxdemarzi / neography

A thin Ruby wrapper to the Neo4j Rest API
MIT License
602 stars 135 forks source link

DeadLockDetectException issue #186

Closed kwent closed 6 years ago

kwent commented 10 years ago

Apparently Neography::DeadlockDetectedException != org.neo4j.kernel.DeadlockDetectedException


begin
      puts "| GraphWriterHelper | START BATCH CALL | QUEUE SIZE : #{queue.size} |"
      response = Neo.instance.batch(*queue)
    rescue Neography::DeadlockDetectedException => e
      # If DeadlockDetectedException try until it's working
      puts "| GraphWriterHelper | EXCEPTION CATCH | #{e.message} | SLEEP 2\" THEN TRY AGAIN |"
      sleep(2)
      retry
    rescue => e
      retry_count -= 1
      if (retry_count > 0)
        puts "| GraphWriterHelper | EXCEPTION CATCH | RETRY COUNT : #{WRITE_RETRY_COUNT - retry_count } | #{e.message} | SLEEP 10\" THEN TRY AGAIN |"
        sleep(5)
        retry
      else
        raise (e.message)
      end
    end
    puts "| GraphWriterHelper | COMPLETED BATCH CALL | QUEUE SIZE : #{queue.size} |"
  end
Details: 'Transaction(4733, owner:"708673055@qtp-912072674-5")[STATUS_ACTIVE,Resources=2] can't wait on resource RWLock[Node[297830591]] since => Transaction(4733, owner:"708673055@qtp-912072674-5")[STATUS_ACTIVE,Resources=2] <-[:HELD_BY]- RWLock[IndexLock[friends_idx:fb_rel]] <-[:WAITING_FOR]- Transaction(4749, owner:"401424990@qtp-912072674-36")[STATUS_ACTIVE,Resources=2] <-[:HELD_BY]- RWLock[Node[297830591]]'.
    from /mnt/task/load_new_user_into_graph.rb:70:in `block in <top (required)>'
    from /usr/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
    from /mnt/task/load_new_user_into_graph.rb:54:in `<top (required)>'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
    from __runner__.rb:213:in `<main>'
| CHECKPOINT | WRITE | QUEUE |
| GraphWriterHelper | START BATCH CALL | QUEUE SIZE : 209 |
| GraphWriterHelper | EXCEPTION CATCH | RETRY COUNT : 1 | org.neo4j.kernel.DeadlockDetectedException: Don't panic.

A deadlock scenario has been detected and avoided. This means that two or more transactions, which were holding locks, were wanting to await locks held by one another, which would have resulted in a deadlock between these transactions. This exception was thrown instead of ending up in that deadlock.

See the deadlock section in the Neo4j manual for how to avoid this: http://docs.neo4j.org/chunked/stable/transactions-deadlocks.html
maxdemarzi commented 10 years ago

Hum... can you turn on logging (or if it's on already) find the output of https://github.com/maxdemarzi/neography/blob/master/lib/neography/connection.rb#L216

@logger.error "#{response.data} error: #{body}" if @log_enabled

'cause https://github.com/maxdemarzi/neography/blob/master/lib/neography/connection.rb#L240 should be catching it...

kwent commented 6 years ago

Closing for inactivity