Skip to content

LockAcquisitionTimeout when running multiple statements #283

@tim-hanssen

Description

@tim-hanssen

Describe the bug
After upgrading the Neo4j PHP client from version 3.2.0 to 3.4.0, we started encountering frequent Neo.TransientError.Transaction.LockAcquisitionTimeout errors. The issue does not occur in version 3.2.0, but is reproducible in 3.3.0 and 3.4.0.

The error only appears in a very specific part of our codebase where multiple statements are executed in a single request.

To Reproduce
Steps to reproduce the behavior:
1. Upgrade the Neo4j PHP client to version 3.3.0 or 3.4.0 (starting at 3.2.0)
2. Create multiple Statement objects using the a query and parameters that use nodes from the earlier statements.
3. Execute them together using runStatements() with write access
4. Observe Neo.TransientError.Transaction.LockAcquisitionTimeout being thrown

Expected behavior
Executing multiple statements in a single call should behave the same as in version 3.2.0 and complete without triggering lock acquisition timeout errors.
• Library version: 3.4.0 (also reproducible in 3.3.0, not reproducible in 3.2.0)
• Neo4j Version: 4.4.46
• PHP version: 8.3
• OS: FPM Docker 8.3

Additional context
• The issue only occurs when running multiple statements in one call.
• Running the same query as a single statement does not trigger the error.
• Downgrading back to 3.2.0 fully resolves the problem.

This issue is easy for us to reproduce; simply changing the client version from 3.2.0 to 3.3.0 or higher consistently starts triggering this error within minutes.

Example code

$statements[] = new Statement($query, $properties);        
$statements[] = new Statement($query, $properties);

$results = $this->client->getClient()->runStatements($statements, 'write');

if ($results) {

    // At this moment there are no statement names, now we use index 9
    return data_get($results,  9)->first()->get('record');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions