Ошибка запроса шифра Neo4j: NoLock[Конвейер[2]] уже заблокирован

#neo4j #cypher

Вопрос:

Я новичок в использовании neo4j.

Я написал клиент python для выполнения запроса на шифрование через bolt в neo4j. Версия neo4j-4.2.9.

Шифр предназначен для выполнения 3-х прыжковых запросов, как показано ниже

 match (n1:MyNode)-[:MyEdge*0..3]->(n2:MyNode) where id(n1)=123123 return count(distinct n2)
 

Проблемы в том, что запросы через болт иногда не удавались. И сервер neo4j получил ошибки в файле neo4j.log, как показано ниже.

 2021-08-12 03:12:19.517 0000 ERROR id:3721 - 312165 ms: 32990552712 B - bolt-session    bolt    neo4j-python/4.2.0 Python/3.6.9-final-0 (linux)         client/127.0.0.1:43524  server/127.0.0.1:7687>  twitter - neo4j - match (n1:MyNode)-[:MyEdge*0..3]->(n2:MyNode) where id(n1)=$root return count(distinct n2) - {root: 21250581} - runtime=pipelined - {} - NoLock[Pipeline[2]] is already locked
 

Фрагмент кода:

 class Neo4jQueryRunner():
    def __init__(self):
        url = os.environ.get("NEO4J_BOLT", "bolt://127.0.0.1:7687")
        self.driver = GraphDatabase.driver(url, auth=basic_auth("neo4j", "benchmark"))
        self.session = self.driver.session()

    def khop(self, root, depth, api="cypher"):
        try:
            if api == "cypher":
                result = self.session.run("match (n1:MyNode)-[:MyEdge*0.."   str(
                    depth)   "]->(n2:MyNode) where id(n1)=$root return count(distinct n2)", {"root": int(root)})
                record = result.peek()
            # elif api == "apoc":
            #     # TODO
            #     result = self.session.run("match (n1:MyNode)-[:MyEdge*0.."   str(
            #         depth)   "]->(n2:MyNode) where n1.id={root} return count(distinct n2)", {"root": root})
            #     record = result.peek()
            else:
                self.session.close()
                self.session = self.driver.session()
                return -1  # timeout, we return -1, reset session
        except Exception as e:
            print("Khop query got exception: {}".format(str(e)))
            self.session.close()
            self.session = self.driver.session()
            return -1  # timeout, we return -1, reset session
        else:
            return record["count(distinct n2)"]
 

Не могли бы вы, пожалуйста, кто-нибудь помочь мне разобраться, что происходит?

Комментарии:

1. github.com/neo4j/neo4j/issues/12700