Connection dropping after 1 hour

Hello,

We're seeing unusual behaviour with the DB connection (presumably) dropping after exactly 1 hour. We're running the below (as a Cloud Function in GCP), which is very active writing to the DB minute by minute but after an hour the connection drops with no messages from the driver (we're still sifting through the numerous DB logs). We were not experiencing this behaviour when running the same code (also in GCP) against a Aura-hosted DB but only since we migrated to Azure. We're using Python driver 5.16.0 against an Enterprise-licensed Neo4j v5.18.1 DB deployed using the Azure marketplace template, with no configuration customisation.

Any suggestions (beyond the DB logs) for investigation would be greatly appreciated.

Thanks in advance, Henry.

import logging
import os
import uuid
from datetime import datetime

import functions_framework
import google.cloud.logging


from neo4j import GraphDatabase, ManagedTransaction

URI = os.getenv("NEO4J_URI")
AUTH = (os.getenv("NEO4J_USERNAME"), os.getenv("NEO4J_PASSWORD"))
DATABASE = os.getenv("NEO4J_DATABASE")


def start_process():
    # logic calls write_cypher repeatedly
    return ''

def write_cypher(cypher, results_json):
    '''Runs a write query against Neo4j'''
    with driver.session() as session:
        results = session.write_transaction(
            run_write_query, cypher, results_json)

        return results

def run_write_query(tx: ManagedTransaction, cypher, results_json):
    '''Runs a write query against Neo4j'''
    result = tx.run(cypher, parameters={"logicResults": results_json})

    return result.data()

with GraphDatabase.driver(URI, auth=AUTH, database=DATABASE) as driver:
    driver.verify_connectivity()

Hi Henry, it would be best if you open a regular support ticket then, so the support / cloud infrastructure teams can help you there where they have access to more details.

Did you try to upgrade the driver to 5.18 too?

But it feels like an infrastructure cut-off. Please share in the ticket if you're running a cluster. In general the driver should ensure that lost connections are re-acquired. One thing that you could set is retries so that in case of transient failures it would retry at least 1-2 times?

https://support.neo4j.com/