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

loadAllMembers does not work on 32-bits PHP with large guilds #685

Open
SQKo opened this issue Jan 21, 2022 · 1 comment
Open

loadAllMembers does not work on 32-bits PHP with large guilds #685

SQKo opened this issue Jan 21, 2022 · 1 comment
Assignees
Labels
bug dependencies Pull requests that update a dependency file

Comments

@SQKo
Copy link
Member

SQKo commented Jan 21, 2022

EDIT: Temporary fix by applying
composer require ratchet/rfc6455:"dev-master#82760a7 as 0.3.1


Enabling loadAllMembers options running on 32-bits PHP when the bot is at least in one of guild considered "large" will crash after chunking up the members:

[2022-01-20T04:29:43.510365+00:00] DiscordPHP.DEBUG: guild available {"guild":"872531095621615646","unavailable":1} []
[2022-01-20T04:29:43.511365+00:00] DiscordPHP.INFO: all guilds are now available {"count":2} []
[2022-01-20T04:29:43.511365+00:00] DiscordPHP.INFO: set up chunking, checking for chunks every 5 seconds [] []
[2022-01-20T04:29:43.511365+00:00] DiscordPHP.DEBUG: sending 1 chunks with 2 large guilds overall [] []
[2022-01-20T04:29:43.511365+00:00] DiscordPHP.DEBUG: sending chunk with 2 large guilds [] []
PHP Warning:  unpack(): 64-bit format codes are not available for 32-bit versions of PHP in D:\Install\discord-php-bot\vendor\ratchet\rfc6455\src\Messaging\MessageBuffer.php on line 163
PHP Notice:  Trying to access array offset on value of type bool in D:\Install\discord-php-bot\vendor\ratchet\rfc6455\src\Messaging\MessageBuffer.php on line 163
PHP Fatal error:  Uncaught UnderflowException: Frame must be coalesced before applying mask in D:\Install\discord-php-bot\vendor\ratchet\rfc6455\src\Messaging\Frame.php:78
Stack trace:
#0 [internal function]: Ratchet\RFC6455\Messaging\Frame::Ratchet\RFC6455\Messaging\{closure}()
#1 D:\Install\discord-php-bot\vendor\ratchet\rfc6455\src\Messaging\Frame.php(287): call_user_func()
#2 D:\Install\discord-php-bot\vendor\ratchet\rfc6455\src\Messaging\MessageBuffer.php(216): Ratchet\RFC6455\Messaging\Frame->unMaskPayload()
#3 D:\Install\discord-php-bot\vendor\ratchet\rfc6455\src\Messaging\MessageBuffer.php(194): Ratchet\RFC6455\Messaging\MessageBuffer->processData()
#4 D:\Install\discord-php-bot\vendor\evenement\evenement\src\Evenement\EventEmitterTrait.php(123):
Ratchet\RFC6455\Messaging\MessageBuffer->onData()
#5 D:\Install\discord-php-bot\vendor\react\stream\src\Util.php(71): Evenement\EventEmitter->emit()
#6 D:\Install\discord-php-bot\vendor\evenement\evenement\src\Evenement\EventEmitterTrait.php(123):
React\Stream\Util::React\Stre in D:\Install\discord-php-bot\vendor\ratchet\rfc6455\src\Messaging\Frame.php on line 78

Stable v6.0.3 is also affected.

Might be related to the ratchetphp library.

Fixed by ratchetphp/RFC6455#65

Note: the fix only increased payload limit from 65 KB to 2 GB. Don't expect a 32-bits php can store all members in a very large guild with thousands of members going over 2 GB, that crash would simply mean you need more RAM and 64-bits php to cover it.

@SQKo SQKo added bug need more information dependencies Pull requests that update a dependency file and removed need more information labels Jan 21, 2022
@key2peace key2peace added this to the 8.0 milestone Feb 15, 2022
@SQKo SQKo modified the milestones: 8.0, 7.0 Apr 23, 2022
key2peace added a commit that referenced this issue Aug 10, 2022
Modify composer.json to suggest composer-patches for users to enable patching ratchet/rfc6455 on 32bit.
This is a **TEMPORARY** fix for #685, until PR65 has been merged with ratchet or the bug has been resolved otherwise.
@key2peace key2peace pinned this issue Aug 10, 2022
@SQKo
Copy link
Member Author

SQKo commented Aug 17, 2022

Since the PR is now merged (not released yet), you can temporarily apply the patch by:
composer require ratchet/rfc6455:"dev-master#82760a7 as 0.3.1

We'll add the patched version to requirements ASAP once it's released.

@SQKo SQKo unpinned this issue Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

2 participants