neo4j-php / neo4j-php-client

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

Automatic reconnect #234

Open tomswinkels opened 1 week ago

tomswinkels commented 1 week ago

Sometimes we have long-running jobs and then we get some errors.

fwrite(): Send of 8 bytes failed with errno=32 Broken pipe

Maybe it is better that the client can detect when the connection is broken and do a reconnect.

#2 /code/vendor/stefanak-michal/bolt/src/connection/StreamSocket.php(76): fwrite()
#3 /code/vendor/stefanak-michal/bolt/src/protocol/AProtocol.php(70): Bolt\connection\StreamSocket->write()
#4 /code/vendor/stefanak-michal/bolt/src/protocol/v3/RunMessage.php(20): Bolt\protocol\AProtocol->write()
#5 /code/vendor/laudis/neo4j-php-client/src/Bolt/BoltConnection.php(225): Bolt\protocol\V4_4->run()
#6 /code/vendor/laudis/neo4j-php-client/src/Bolt/BoltUnmanagedTransaction.php(138): Laudis\Neo4j\Bolt\BoltConnection->run()
#7 /code/vendor/laudis/neo4j-php-client/src/Bolt/Session.php(70): Laudis\Neo4j\Bolt\BoltUnmanagedTransaction->runStatement()
#8 /code/vendor/laudis/neo4j-php-client/src/Client.php(110): Laudis\Neo4j\Bolt\Session->runStatements()
#9 /code/vendor/laudis/neo4j-php-client/src/Client.php(80): Laudis\Neo4j\Client->runStatements()
#10 /code/vendor/laudis/neo4j-php-client/src/Client.php(75): Laudis\Neo4j\Client->runStatement()
#11 /code/app/Models/Api5/Guide.php(48): Laudis\Neo4j\Client->run()
exaby73 commented 1 week ago

Hey @tomswinkels. Sorry for the late response. I'd like some more information about what caused this issue. Are you running a single long running query or multiple smaller queries?

tomswinkels commented 1 week ago

Hey @exaby73 no problem!

This issue has nothing to do with the runtime of a query.

It's a long-running job that do more than only execute some queries.

When we do before every query again a client connect than the problem will be solved, but we think that it's better that the client check if the connection is active or not.