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()