Skip to content

Websocket Consumer can get stuck in infinite connection loop #22

Closed

Description

@Archmonger

Old Behavior

WebSocket HANDSHAKING /_idom/websocket/test_app.components.ParametrizedComponent/ [127.0.0.1:61944]
WebSocket CONNECT /_idom/websocket/test_app.components.ParametrizedComponent/ [127.0.0.1:61944]
WebSocket DISCONNECT /_idom/websocket/test_app.components.ParametrizedComponent/ [127.0.0.1:61944]
WebSocket HANDSHAKING /_idom/websocket/test_app.components.ParametrizedComponent/ [127.0.0.1:61945]
WebSocket CONNECT /_idom/websocket/test_app.components.ParametrizedComponent/ [127.0.0.1:61945]
WebSocket DISCONNECT /_idom/websocket/test_app.components.ParametrizedComponent/ [127.0.0.1:61945]
WebSocket HANDSHAKING /_idom/websocket/test_app.components.SimpleBarChart/ [127.0.0.1:61953]
WebSocket CONNECT /_idom/websocket/test_app.components.SimpleBarChart/ [127.0.0.1:61953]
WebSocket DISCONNECT /_idom/websocket/test_app.components.SimpleBarChart/ [127.0.0.1:61953]
WebSocket HANDSHAKING /_idom/websocket/test_app.components.Button/ [127.0.0.1:61955]
WebSocket CONNECT /_idom/websocket/test_app.components.Button/ [127.0.0.1:61955]
WebSocket DISCONNECT /_idom/websocket/test_app.components.Button/ [127.0.0.1:61955]
WebSocket HANDSHAKING /_idom/websocket/test_app.components.HelloWorld/ [127.0.0.1:61956]
WebSocket CONNECT /_idom/websocket/test_app.components.HelloWorld/ [127.0.0.1:61956]
WebSocket DISCONNECT /_idom/websocket/test_app.components.HelloWorld/ [127.0.0.1:61956]
WebSocket HANDSHAKING /_idom/websocket/test_app.components.ParametrizedComponent/ [127.0.0.1:61957]
WebSocket CONNECT /_idom/websocket/test_app.components.ParametrizedComponent/ [127.0.0.1:61957]
WebSocket DISCONNECT /_idom/websocket/test_app.components.ParametrizedComponent/ [127.0.0.1:61957]
HTTP GET /_idom/web_module/from-template/victory-bar.js 200 [0.01, 127.0.0.1:64500]

I'm really not sure how to trigger this. Seems to happen sometimes while using the development webserver with autoreload (settings.py:DEBUG=True)

When this occurs, the websocket will be stuck in a perpetual handshake/connect loop for a minute or two. Happens the same within Conreq, and I'm not using any external web modules over there yet.

Somehow, using a keyboard interrupt (CTRL+C) to attempt to escape the situation does not resolve the bug. Will still be stuck in this infinite connection loop upon restarting the development webserver (manage.py runserver)

New Behavior

WS connection and render should be performed smoothly

Implementation Details

Need to debug

Code of Conduct

Activity

  1. Archmonger commented on Oct 27, 2021

    @Archmonger
    ContributorAuthor

    Yeah this is actually a massive issue, it keeps occurring during typical development workflows which keeps halting development until it resolves itself.

    Performing development off the #17 branch, since the main branch still doesn't have a pinned django-idom-client version.

  2. Archmonger commented on Oct 28, 2021

    @Archmonger
    ContributorAuthor

    Seems like rapidly refreshing the page generated by manage.py runserver is enough to induce this issue to occur.

    Perhaps it's related to refreshing the page in the middle of the element's first render.

  3. Archmonger commented on Oct 28, 2021

    @Archmonger
    ContributorAuthor

    @rmorshea This issue definitely falls under P1/Critical.

    Confirmed this also occurs in non-development environments. Since an exception isn't being generated by this, I can't trace down the exact problematic LOC.

    This fully breaks IDOM for web usage, since IDOM completely halts whenever a webpage is refreshed too quickly.

    My best guess is this is some bug related to dispatch_single_view (see previous comment), which means it digs into IDOM Core.

    I've confirmed I can also completely break IDOM on our server used for IDOM docs examples.

  4. rmorshea commented on Oct 28, 2021

    @rmorshea
    Contributor

    Dang... that's a bad one. My best guess is that the server gets held up trying to create and then immediately stop the dispatch loop each time the user refreshes the page? At least the page eventually recovers. It just takes a long time.

  5. Archmonger commented on Oct 28, 2021

    @Archmonger
    ContributorAuthor

    Recovery takes 1-2 minutes, but I'm not sure exactly what is timing out.

  6. rmorshea commented on Oct 28, 2021

    @rmorshea
    Contributor

    Can you report this problem in an idom-team/idom discussion? We might need to organize a debug session. I have a feeling this is going to be rather nasty to tease out.

  7. Archmonger commented on Oct 28, 2021

    @Archmonger
    ContributorAuthor

    Discussion created
    reactive-python/reactpy#524

  8. Archmonger commented on Jan 3, 2022

    @Archmonger
    ContributorAuthor

    Can no longer reproduce on Chromium/Brave builds. Seems to have been patched.

    Closing this issue ticket.

  9. added theissue type on Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions