friends-of-reactphp / mysql

Async MySQL database client for ReactPHP.
MIT License
331 stars 66 forks source link

Emit timeout error if socket connection dies silently #174

Open clue opened 1 year ago

clue commented 1 year ago

This project already supports detecting closed connections when receiving a close event. On top of this, to account for situations where the socket connection may die silently (e.g. due to power outage or network failure), we should also consider a connection dead if we don't receive any response to an outstanding query within a timeout period (default could be 600s?).

It's important to note that MySQL employs request/response semantics, and the server is expected to send query results in a timely manner. That being said, slow queries that are inefficient or process loads of data can take significantly longer.

Out of scope: MySQL also allows sending regular heartbeat/ping messages to keep the connection alive if there is no activity for a certain time, but we employ an idle connection time for this case anyway (see #147 / #88).

Refs https://github.com/clue/reactphp-redis/issues/142, https://github.com/clue/reactphp-eventsource/issues/37 and others

We welcome contributions, reach out if you want to support this project or become a sponsor ❤️