Skip to content

Fix Infinite Loop in WebSocket Connection Message Handling #1402

Open
@zdhdsx

Description

@zdhdsx

Description:
A critical issue was identified in the previous WebSocket connection message handling logic where messages could enter an infinite retry loop during connection establishment.

Current Behavior:
When a message arrives while WebSocket connection is being established (self.ws is None but self.ws_future exists), the code recursively adds the message handling as a future callback, potentially creating an infinite loop if the connection fails repeatedly.

Technical Details:

  • Location:
  • Class:
  • Previous problematic code pattern:
if self.ws is None and self.ws_future is not None:
    loop = IOLoop.current()
    loop.add_future(self.ws_future, lambda future: self.handle_incoming_message(message))

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