Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Runtime Error On Unexpected Client Disconnection #73

Open
metaclassing opened this issue Sep 28, 2015 · 0 comments
Open

Fatal Runtime Error On Unexpected Client Disconnection #73

metaclassing opened this issue Sep 28, 2015 · 0 comments

Comments

@metaclassing
Copy link

Hi,

I have a fairly simple realtime game using Wrench and Msgpack, javascript client side and PHP back-end. The game itself works well in steady-state but in real world testing I have found alot of instances where if the client goes away, such as a user closes the tab, or reloads their tab in a browser (most testing is Chrome) the PHP daemon will crash:

Client 68.225.172.43:5177 joined game ws://192.99.44.xyz:1502#BESVL (2 players)
sendPacket exception: Socket is not connected
Got log level warning message Wrench\ConnectionManager: Wrench\Connection: 68.225.172.43:5177 (48ac8453791e1b01c876a918de88030b685c5cec9496904ca3e9af2c61512da67e4a1f32e6cc117dd6e45fe72bb4ac1d5340cfc793e0780378d0ffeee826eaf8): Unable to send close message
Client 68.225.172.43:5177 left game ws://192.99.44.xyz:1502#BESVL (1 players remaining)
Client 68.225.172.43:5177 disconnected
Got log level warning message Wrench\ConnectionManager: Error on client socket: exception 'Wrench\Exception\HandshakeException' with message 'Socket is not connected' in /opt/dmr/vendor/wrench/wrench/lib/Wrench/Connection.php:241
Stack trace:
#0 /opt/dmr/vendor/wrench/wrench/lib/Wrench/Connection.php(206): Wrench\Connection->handshake('GET /minimap HT...')
#1 /opt/dmr/vendor/wrench/wrench/lib/Wrench/Connection.php(399): Wrench\Connection->onData('GET /minimap HT...')
#2 /opt/dmr/vendor/wrench/wrench/lib/Wrench/ConnectionManager.php(243): Wrench\Connection->process()
#3 /opt/dmr/vendor/wrench/wrench/lib/Wrench/ConnectionManager.php(168): Wrench\ConnectionManager->processClientSocket(Resource id #44)
#4 /opt/dmr/vendor/wrench/wrench/lib/Wrench/Server.php(198): Wrench\ConnectionManager->selectAndProcess()
#5 /opt/dmr/server.php(20): Wrench\Server->run()
#6 {main}
Got log level warning message Wrench\ConnectionManager: Wrench\Connection: 68.225.172.43:5198 (67643d2ef47993810183eef1fc857b7178c3c4c1c37ea85fce3e2172ba7789e8154c005c86619706e395e4909f2f404a9e7473839144626a612b6602db7b64a2): Unable to send close message
Client 68.225.172.43:5198 disconnected

PHP Fatal error:  Call to a member function getRemainingData() on a non-object in /opt/dmr/vendor/wrench/wrench/lib/Wrench/Payload/Payload.php on line 169
PHP Stack trace:
PHP   1. {main}() /opt/dmr/server.php:0
PHP   2. Wrench\Server->run() /opt/dmr/server.php:20
PHP   3. Wrench\ConnectionManager->selectAndProcess() /opt/dmr/vendor/wrench/wrench/lib/Wrench/Server.php:198
PHP   4. Wrench\ConnectionManager->processClientSocket() /opt/dmr/vendor/wrench/wrench/lib/Wrench/ConnectionManager.php:168
PHP   5. Wrench\Connection->process() /opt/dmr/vendor/wrench/wrench/lib/Wrench/ConnectionManager.php:243
PHP   6. Wrench\Connection->onData() /opt/dmr/vendor/wrench/wrench/lib/Wrench/Connection.php:399
PHP   7. Wrench\Connection->handle() /opt/dmr/vendor/wrench/wrench/lib/Wrench/Connection.php:208
PHP   8. Wrench\Payload\PayloadHandler->handle() /opt/dmr/vendor/wrench/wrench/lib/Wrench/Connection.php:300
PHP   9. Wrench\Payload\Payload->receiveData() /opt/dmr/vendor/wrench/wrench/lib/Wrench/Payload/PayloadHandler.php:75

I have tried wrapping the entire server->run() in a try block to handle any exceptions, but the fatal runtime error is uncatchable (at least until PHP7 later this year, and I don't know what the Wrench library has planned for version support.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant