-
Notifications
You must be signed in to change notification settings - Fork 154
Open
Labels
Description
Bug Report
A read transaction using session.executeRead() fails to release its connection back to the pool, causing connection pool exhaustion. The transaction appears to hang indefinitely despite completing the query execution, leading to subsequent connection acquisition timeouts.
Driver configuration
Connection Pool Size: 100
Connection Acquisition Timeout: 60,000ms
Connection Timeout: 30,000ms
Read Query Timeout: 60,000ms
Max Connection Lifetime: 180,000ms
Max Transaction Retry Time: 30,000ms
Simplified code
import neo4j from 'neo4j-driver';
const manager = neo4j.authTokenManagers.bearer({
tokenProvider: awsNeptuneTokenProvider,
});
const driver = neo4j.driver(env.GRAPH_DB_URL, manager, {
encrypted: 'ENCRYPTION_ON',
trust: 'TRUST_SYSTEM_CA_SIGNED_CERTIFICATES',
});
const session = driver.session({
defaultAccessMode: neo4j.session.READ,
});
try {
await session.executeRead((tx) => tx.run(cypher, params), {
timeout: 60_000,
});
} finally {
await session.close();
}
Logs
1759865156412 DEBUG Connection [982][] created towards cluster.cluster-id.region.neptune.amazonaws.com:8182
1759865156413 DEBUG Connection [982][] C: HELLO {user_agent: 'neo4j-javascript/5.28.1', ...}
1759865159472 DEBUG Connection [982][] S: SUCCESS
{
"signature": 112,
"fields": [
{
"server": "Neo4j/4.2.0-compatible-by-amazon-neptune",
"connection_id": "766799fffe810dfc-0000688c-00000023-1c20207330f1adfb-70b4b568"
}
]
}
1759865159472 DEBUG Connection [982][766799fffe810dfc-0000688c-00000023-1c20207330f1adfb-70b4b568] created for the pool cluster.cluster-id.region.neptune.amazonaws.com:8182
1759865159472 DEBUG Connection [982][766799fffe810dfc-0000688c-00000023-1c20207330f1adfb-70b4b568] acquired from the pool cluster.cluster-id.region.neptune.amazonaws.com:8182
1759865159472 DEBUG Connection [982][766799fffe810dfc-0000688c-00000023-1c20207330f1adfb-70b4b568] C: BEGIN
{
"tx_timeout": {
"low": 60000,
"high": 0
},
"mode": "r"
}
1759865159511 DEBUG Connection [982][766799fffe810dfc-0000688c-00000023-1c20207330f1adfb-70b4b568] S: SUCCESS
{
"signature": 112,
"fields": [
{}
]
}
1759865159511 DEBUG Connection [982][766799fffe810dfc-0000688c-00000023-1c20207330f1adfb-70b4b568] C: RUN MATCH (source:<organizationId>:CONTEXT { node_id: $param0 })
OPTIONAL MATCH (source)-[relation]->(target)
RETURN source, relation, target
{
"param0": "<node_id>"
}
{}
// 19:25:59
1759865159511 DEBUG Connection [982][766799fffe810dfc-0000688c-00000023-1c20207330f1adfb-70b4b568] C: PULL_ALL
// 19:27:01 - SUCCESS message arrived 1 minute after PULL ALL
1759865221923 DEBUG Connection [982][766799fffe810dfc-0000688c-00000023-1c20207330f1adfb-70b4b568] S: SUCCESS
{
"signature": 112,
"fields": [
{
"result_available_after": 0,
"fields": [
"source",
"relation",
"target"
]
}
]
}
1759865534855 WARN ConnectionHolder got an error while releasing the connection. Error Neo4jError: Connection acquisition timed out in 60000 ms. Pool status: Active conn count = 1, Idle conn count = 0.. Stacktrace: Neo4jError: Connection acquisition timed out in 60000 ms. Pool status: Active conn count = 1, Idle conn count = 0.
at Neo4jError.GQLError [as constructor] (/usr/src/app/node_modules/.pnpm/neo4j-driver-core@5.28.1/node_modules/neo4j-driver-core/lib/error.js:117:24)
at new Neo4jError (/usr/src/app/node_modules/.pnpm/neo4j-driver-core@5.28.1/node_modules/neo4j-driver-core/lib/error.js:204:28)
at newError (/usr/src/app/node_modules/.pnpm/neo4j-driver-core@5.28.1/node_modules/neo4j-driver-core/lib/error.js:246:12)
at Timeout.<anonymous> (/usr/src/app/node_modules/.pnpm/neo4j-driver-core@5.28.1/node_modules/neo4j-driver-core/lib/internal/pool/pool.js:148:77)
at listOnTimeout (node:internal/timers:588:17)
at process.processTimers (node:internal/timers:523:7)
My Environment
Javascript Runtime Version: node 22.14.0
Driver Version: 5.28.1
Neo4j Version and Edition: AWS Neptune 4.2.0-compatible
Operating System: Docker node:22-alpine