Ratchet on 100% CPU load
Hi,

We are having an issue with running a ratchet server in production environment. Sometimes the server (process) just skyrockets to server load using 97-100% of one core on server. Server is running on PHP 5.6.0 with PHP-FPM and Nginx.

We are using the latest repositories currently available:
cboden/ratchet v0.3.2
react/event-loop v0.4.1
react/socket v0.4.2
react/stream 0.4.2

Libevent library is installed and ratchet is using this library (var_dump($server->loop); outputs the libevent loop). I know there is an issue about this [here](https://github.com/ratchetphp/Ratchet/issues/137) but it was closed an I am still experiencing it. The issue occurs randomly, sometimes in the middle of the night, but today it occured around evening and I was promptly informed. I restarted the proces but after a few seconds it skyrocketed again (the JS client is implementing a keepalive system and thus is trying to reconnect every few seconds). After many restarts it still used the full CPU, I was able to just look and try to restart it every few minutes. After around 30 minutes and many restarts it returned back to normal. The traffic on this prcoess is pretty big, with around 400-700 clients connected at the same time. I am unable to track what causes the issue, but from my understanding something enters the loop and causes a lag in it. Because it started today right after restart, I think there was a client that somehow connected the wrong way and something caused a leak or error, that in loop used the full CPU. Just my guess.

While it is on full load, some clients are connected and new clients can't connect. I am stressed out because the app is in production and real-time events are a pretty important and big part of it and the whole solution depends on it.

I cannot run an XDebug on production, is there any other way I can track what causes this can have, or any workaround to solve this?

Thank you for your replies.
