neo4j-contrib / py2neo

EOL! Py2neo is a comprehensive Neo4j driver library and toolkit for Python.
https://py2neo.org
Apache License 2.0
20 stars 8 forks source link

Index error out of range #931

Closed Gmaquina closed 2 years ago

Gmaquina commented 2 years ago

Randomly crash on the graph.run() func with a query that works perfectly fine in the Neo4j browser.

query ='''
USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM 'file:///work/outputWithColumn10000Row.csv' AS line
MERGE(from:table  {patentid: line.fromnodeid})
MERGE(to:table  {patentid: line.tonodeid})
MERGE(from)-[:CITE]->(to)
'''

for truc in range(6):

    graph.run("match (a) -[r] -> () delete a, r")
    graph.run("match (a) delete a")

    graph.run(query)

with this error mesage:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/tmp/ipykernel_59/4222532258.py in <module>
     24     graph.run("match (a) delete a")
     25 
---> 26     graph.run(query)
     27 

/opt/conda/lib/python3.9/site-packages/py2neo/database.py in run(self, cypher, parameters, **kwparameters)
    403         :return:
    404         """
--> 405         return self.auto().run(cypher, parameters, **kwparameters)
    406 
    407     def evaluate(self, cypher, parameters=None, **kwparameters):

/opt/conda/lib/python3.9/site-packages/py2neo/database.py in run(self, cypher, parameters, **kwparameters)
    990                                                   graph_name=self.graph.name,
    991                                                   readonly=self.readonly)
--> 992             self._connector.pull(result, -1)
    993             return Cursor(result, hydrant)
    994         finally:

/opt/conda/lib/python3.9/site-packages/py2neo/client/__init__.py in pull(self, result, n)
   1432         cx = self._reacquire(result.transaction)
   1433         try:
-> 1434             cx.pull(result, n=n)
   1435         except (ConnectionUnavailable, ConnectionBroken):
   1436             self.prune(cx.profile)

/opt/conda/lib/python3.9/site-packages/py2neo/client/bolt.py in pull(self, result, n, capacity)
    969         result.append(response, final=(n == -1))
    970         try:
--> 971             self._sync(response)
    972         except BrokenWireError as error:
    973             result.transaction.mark_broken()

/opt/conda/lib/python3.9/site-packages/py2neo/client/bolt.py in _sync(self, *responses)
    773         self.send()
    774         for response in responses:
--> 775             self._wait(response)
    776 
    777     def _audit(self, task):

/opt/conda/lib/python3.9/site-packages/py2neo/client/bolt.py in _wait(self, response)
    768         """
    769         while not response.full() and not response.done():
--> 770             self._fetch()
    771 
    772     def _sync(self, *responses):

/opt/conda/lib/python3.9/site-packages/py2neo/client/bolt.py in _fetch(self)
    743         failed state into an exception.
    744         """
--> 745         tag, fields = self.read_message()
    746         if tag == 0x70:
    747             self._responses.popleft().set_success(**fields[0])

/opt/conda/lib/python3.9/site-packages/py2neo/client/bolt.py in read_message(self)
    670 
    671     def read_message(self):
--> 672         tag, fields = self._reader.read_message()
    673         if tag == 0x71:
    674             # If a RECORD is received, check for more records

/opt/conda/lib/python3.9/site-packages/py2neo/client/bolt.py in read_message(self)
    163                 chunks.append(self.wire.read(size))
    164         message = b"".join(chunks)
--> 165         _, n = divmod(message[0], 0x10)
    166         try:
    167             fields = list(unpack(message, offset=2))

IndexError: index out of range

I couldn't find any solution online so im posting it here.

technige commented 2 years ago

See also #918 and #922. This bug was fixed in the latest release... therefore, please upgrade.