Skip to content

[BUG] PPPP service does not stop trying to contact the printer when the last websocket is closed #158

@treitmayr

Description

@treitmayr

Bug Description
When the ankerctl web server runs, the printer is not available, and at least one browser is connected to ankerctl, the server tries to contact the printer coninuously, as would be expected so that the PPPP badge can be updated.
However, when the browser (tab) is closed, the server still tries to contact the printer via PPPP. When started as a docker service, this will result in constant write accesses to the log file.

Note: This bug is not related to the number of bugs concerning unsuccessful PPPP connections!

To Reproduce
Steps to reproduce the behavior:

  1. Turn off printer
  2. Start ankerctl web server
  3. Connect with a web browser to the web server
  4. Check that the web server starts printing messages
    Trying connect to printer AnkerMake M5C (EUPRAKM-013657-LNCZN) over pppp using ip <IP>
  5. Close the browser (tab)
  6. The ankerctl web server will not stop printing the above message

Expected Behavior
As soon as there is no websocket connection from any web browser to the PPPP websocket endpoint anymore, ankerctl should stop trying to contact the printer via PPPP.

Additional Context
This issue can be observed using the master branch as well as the modified version of PR #145 and anselor:exiles.

Initial Analysis
The PPPP service is implemented in a way that it is only "started" when the PPPP could be established. The ServiceManager.borrow() and ServiceManager.stream() functions called by the websocket endpoint both try to start the PPPP service without employing any timeout meachanism.
Furthermore (and possibly only relevant for the PR #145 version), the PPPP websocket endpoint should check if the websocket connection is still alive inside its loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions