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

Websocket server drop connection on attempting to receive text (JSON) message more than 65535 bytes #280

Closed
ikalaushin opened this issue Jul 11, 2017 · 1 comment

Comments

@ikalaushin
Copy link

ikalaushin commented Jul 11, 2017

Websocket server drop connection on attempting to receive text (JSON) message more than 65535 bytes

We have a WebSocket server which should receive data in JSON format. We use it as app custom API backend. In case when app tries ti send data packet more then ~70KB size we have situation when PHPD can't read anything from WS. No data, no PONGs.
Only less than 65535 bytes of data can be received
65527 bytes of data received for example

For debug purpose we add next code to PHPDaemon\Servers\WebSocket\Protocols\V13::onRead

        $this->log(sprintf('BufferLength: %d',
            $this->getInputLength()
        ));

Few strinds of custom log information for debugging
[Tue, 11 Jul 2017 19:04:07.726997 +0000] - moment of receiving data packet with size ~100KB

[Tue, 11 Jul 2017 19:04:02.600623 +0000]  [INFO]  Client session was created
[Tue, 11 Jul 2017 19:04:03.259788 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:03.260347 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 6
[Tue, 11 Jul 2017 19:04:03.260583 +0000]  [->PONG]  was got from: session 1 in pid 7285
[Tue, 11 Jul 2017 19:04:04.265627 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:04.266224 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 6
[Tue, 11 Jul 2017 19:04:04.266398 +0000]  [->PONG]  was got from: session 1 in pid 7285
[Tue, 11 Jul 2017 19:04:05.271233 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:05.271876 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 6
[Tue, 11 Jul 2017 19:04:05.272038 +0000]  [->PONG]  was got from: session 1 in pid 7285
[Tue, 11 Jul 2017 19:04:06.274393 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:06.274957 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 6
[Tue, 11 Jul 2017 19:04:06.275126 +0000]  [->PONG]  was got from: session 1 in pid 7285
[Tue, 11 Jul 2017 19:04:07.279840 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:07.280482 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 6
[Tue, 11 Jul 2017 19:04:07.280672 +0000]  [->PONG]  was got from: session 1 in pid 7285
[Tue, 11 Jul 2017 19:04:07.726997 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 4096
[Tue, 11 Jul 2017 19:04:07.727273 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 8192
[Tue, 11 Jul 2017 19:04:07.727465 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 12288
[Tue, 11 Jul 2017 19:04:07.727655 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 16384
[Tue, 11 Jul 2017 19:04:07.727861 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 20480
[Tue, 11 Jul 2017 19:04:07.728044 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 24576
[Tue, 11 Jul 2017 19:04:07.728228 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 28672
[Tue, 11 Jul 2017 19:04:07.728409 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 32768
[Tue, 11 Jul 2017 19:04:07.728593 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 36864
[Tue, 11 Jul 2017 19:04:07.728710 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 40960
[Tue, 11 Jul 2017 19:04:07.728820 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 45056
[Tue, 11 Jul 2017 19:04:07.728929 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 49152
[Tue, 11 Jul 2017 19:04:07.729058 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 53248
[Tue, 11 Jul 2017 19:04:07.729199 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 57344
[Tue, 11 Jul 2017 19:04:07.729329 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 61440
[Tue, 11 Jul 2017 19:04:07.729458 +0000] PHPDaemon\Servers\WebSocket\Protocols\V13: BufferLength: 65535
[Tue, 11 Jul 2017 19:04:08.283929 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:09.289373 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:10.294753 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:11.300096 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:12.301874 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:13.307302 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:14.312672 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:15.318120 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:16.319834 +0000]  [PING->]  was sent to session: 1 in pid 7285
[Tue, 11 Jul 2017 19:04:17.325221 +0000]  [WARNING]  Ping fail on clientId:1 in pid 7285
[Tue, 11 Jul 2017 19:04:17.325328 +0000]  [DEBUG]  Trying to close connect for client: 1
[Tue, 11 Jul 2017 19:04:17.325467 +0000]  [INFO]  YouServer\YouServerClientSession::onFinish called! clientId: 1 in pid: 7285
@ikalaushin ikalaushin changed the title Websocket server drop connection on attempting to receive text (JSON) message 100KB or more Websocket server drop connection on attempting to receive text (JSON) message 60-100KB or more Jul 11, 2017
@ikalaushin ikalaushin changed the title Websocket server drop connection on attempting to receive text (JSON) message 60-100KB or more Websocket server drop connection on attempting to receive text (JSON) message 70-100KB or more Jul 11, 2017
@ikalaushin ikalaushin changed the title Websocket server drop connection on attempting to receive text (JSON) message 70-100KB or more Websocket server drop connection on attempting to receive text (JSON) message more than 65535 bytes Jul 11, 2017
kuai6 pushed a commit to kuai6/phpdaemon that referenced this issue Jul 14, 2017
…ve text (JSON) message more than 65535 bytes
kakserpom pushed a commit that referenced this issue Jul 16, 2017
#281)

* #280 Websocket server drop connection on attempting to receive text (JSON) message more than 65535 bytes

* add space

* fix typo
@ikalaushin
Copy link
Author

This issue might be closed because of accepting our PR

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

No branches or pull requests

1 participant