neo4j-php-client
neo4j-php-client copied to clipboard
Broken pipe while connected to AuraDB
Describe the bug
We are facing an issue while connected to AuraDB where the our consumer (using Symfony Messenger) starts to throw a Warning: fwrite(): SSL: Connection reset by peer
error on vendor/stefanak-michal/bolt/src/connection/StreamSocket.php:85
.
Once it happens, the connection enters a loop, consuming lots of CPU and the fwrite()
function of the call above sends the Warning: fwrite(): SSL: Broken pipe
warning, never leaving the loop.
To Reproduce We noticed the error at random times. Sometimes it happens around 5 to 15 minutes after our consumer is running. We could reproduce it sometimes by sending many updates to the queue. However, it is still hard to notice exactly when when it happens.
Expected behavior I believe the library should throw an exception and either leave the loop, allowing us to handle the exception properly, or just reconnect automatically when a network error occur.
Desktop (please complete the following information):
- Library version: 3.0.3
- Neo4j Version: 5.13-aura
- PHP version: 8.2.11
- OS: Alpine Linux 3.18 on Docker
Additional context I noticed the bolt library has newer versions that may relate to the issue since the latest version implements the bolt protocol 5.3, although I can't tell if it would fix the issue.
I looked into it and it can be related to something which I was analyzing lately. There is a thing with Neo4j when it enters some weird state and you are reading empty buffer. But it applies only for some versions of Neo4j. For example 5.12 will disconnect you. I've dealt with it recently with some changes and it will be implemented in client version we are working on now.
Solved within https://github.com/neo4j-php/neo4j-php-client/pull/202 related to https://github.com/neo4j-php/neo4j-php-client/issues/198
More details in underlaying driver https://github.com/neo4j-php/Bolt/pull/138 part of latest release bolt v7.0.1
You can try it now through branch https://github.com/neo4j-php/neo4j-php-client/tree/ISSUE-198 if it does solve your issue, or you can wait until new version will be released.