8000 HTTP does not pause WebSocket operations during pending reconnect · Issue #1228 · discord-php/DiscordPHP · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
HTTP does not pause WebSocket operations during pending reconnect #1228
Open
@valzargaming

Description

@valzargaming

Environment

  • PHP Version:
    • 8.3.6
  • DiscordPHP Version:
    • dev-master

Describe the bug
The library continues to attempt operations on the WebSocket while a reconnect is pending, instead of waiting for the reconnection to complete. This can lead to failed requests and unexpected errors.

To Reproduce
Attempt to perform any API calls after op code 1000 is received but before the socket is reconnected, which should happen automatically after 2 seconds.

Expected behavior
The library should not attempt to perform any functions other than reconnect while the websocket is knowingly disconnected. Any other API-related promises that are created during this time should be deferred.

Additional context

[2024-05-19T18:13:03.191376+00:00] Civ13.WARNING: REQ POST channels/690025163634376738/messages failed: Connection to tls://discord.com:443 timed out after 60 seconds (ETIMEDOUT)
[2024-05-19T18:13:03.192807+00:00] Civ13.WARNING: websocket closed {"op":1000,"reason":""}
[2024-05-19T18:13:03.192853+00:00] Civ13.WARNING: reconnecting in 2 seconds
[2024-05-19T18:13:03.194160+00:00] Civ13.WARNING: REQ PATCH channels/1231988255470125117 failed: Connection to tls://discord.com:443 failed during TLS handshake: Connection lost during TLS handshake (ECONNRESET)
[2024-05-19T18:13:03.194254+00:00] Civ13.ERROR: Promise rejected with reason: `RuntimeException: Connection to tls://discord.com:443 failed during TLS handshake: Connection lost during TLS handshake (ECONNRESET) in /home/civ13/Civilizationbot/vendor/react/socket/src/SecureConnector.php:68
Stack trace:
#0 /home/civ13/Civilizationbot/vendor/react/promise/src/RejectedPromise.php(28): React\Socket\SecureConnector->React\Socket\{closure}()
#1 /home/civ13/Civilizationbot/vendor/react/socket/src/SecureConnector.php(64): React\Promise\RejectedPromise->then()
#2 /home/civ13/Civilizationbot/vendor/react/promise/src/FulfilledPromise.php(28): React\Socket\SecureConnector->React\Socket\{closure}()
#3 /home/civ13/Civilizationbot/vendor/react/promise/src/Promise.php(134): React\Promise\FulfilledPromise->then()
#4 /home/civ13/Civilizationbot/vendor/react/promise/src/Promise.php(168): React\Promise\Promise::React\Promise\{closure}()
#5 /home/civ13/Civilizationbot/vendor/react/promise/src/Promise.php(231): React\Promise\Promise->settle()
#6 /home/civ13/Civilizationbot/vendor/react/promise/src/FulfilledPromise.php(28): React\Promise\Promise::React\Promise\{closure}()
#7 /home/civ13/Civilizationbot/vendor/react/promise/src/Promise.php(134): React\Promise\FulfilledPromise->then()
#8 /home/civ13/Civilizationbot/vendor/react/promise/src/Promise.php(168): React\Promise\Promise::React\Promise\{closure}()
#9 /home/civ13/Civilizationbot/vendor/react/promise/src/Promise.php(231): React\Promise\Promise->settle()
#10 /home/civ13/Civilizationbot/vendor/react/promise/src/FulfilledPromise.php(42): React\Promise\Promise::React\Promise\{closure}()
#11 /home/civ13/Civilizationbot/vendor/react/promise/src/Promise.php(135): React\Promise\FulfilledPromise->done()
#12 /home/civ13/Civilizationbot/vendor/react/promise/src/Promise.php(168): React\Promise\Promise::React\Promise\{closure}()
#13 /home/civ13/Civilizationbot/vendor/react/promise/src/Promise.php(231): React\Promise\Promise->settle()
#14 /home/civ13/Civilizationbot/vendor/react/socket/src/TcpConnector.php(145): React\Promise\Promise::React\Promise\{closure}()
#15 /home/civ13/Civilizationbot/vendor/react/event-loop/src/StreamSelectLoop.php(254): React\Socket\TcpConnector->React\Socket\{closure}()
#16 /home/civ13/Civilizationbot/vendor/react/event-loop/src/StreamSelectLoop.php(213): React\EventLoop\StreamSelectLoop->waitForStreamActivity()
#17 /home/civ13/Civilizationbot/vendor/team-reflex/discord-php/src/Discord/Discord.php(1491): React\EventLoop\StreamSelectLoop->run()
#18 /home/civ13/Civilizationbot/src/Civ13.php(797): Discord\Discord->run()
#19 /home/civ13/Civilizationbot/bot.php(429): Civ13\Civ13->run()
#20 {main}'`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0