neo4j-php / neo4j-php-client

Php client and driver for neo4j database
https://neo4j.com/developer/php/
MIT License
159 stars 40 forks source link

Broken pipe while connected to AuraDB #190

Open fernandocarletti opened 10 months ago

fernandocarletti commented 10 months ago

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

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.

stefanak-michal commented 5 months ago

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.