CREATE INDEX from py2neo 2.x sometimes fails

15 views
Skip to first unread message

Ray Chengr

unread,
Aug 31, 2016, 8:33:44 PM8/31/16
to Neo4j
I'm using py2neo 2.x on Neo4j 3.0.3. Sometimes creating index from Python script fails. If I run the same Python line manually from Python 3 IDLE, it almost always succeeds. Any idea? Is this the correct way to create index?

My Python 3 code has these two lines:

    if 'addr' not in graph.schema.get_indexes('host'):
        graph.cypher.execute("CREATE INDEX ON :host(addr)")

and I got these error messages:
   graph.cypher.execute("CREATE INDEX ON :host(addr)")
  File "/usr/local/python/lib/python3.4/site-packages/py2neo/cypher/core.py", line 136, in execute
    results = tx.commit()
  File "/usr/local/python/lib/python3.4/site-packages/py2neo/cypher/core.py", line 333, in commit
    return self.post(self.__commit or self.__begin_commit)
  File "/usr/local/python/lib/python3.4/site-packages/py2neo/cypher/core.py", line 288, in post
    raise self.error_class.hydrate(error)
py2neo.cypher.error.transaction.DeadlockDetected: LockClient[29] can't wait on resource RWLock[SCHEMA(0), hash=1676963340] since => LockClient[29] <-[:HELD_BY]- RWLock[SCHEMA(0), hash=1676963340] <-[:WAITING_FOR]- LockClient[30] <-[:HELD_BY]- RWLock[SCHEMA(0), hash=1676963340]

Thanks,
Ray
Reply all
Reply to author
Forward
0 new messages