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

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

Open
treitmayr opened this issue Mar 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@treitmayr
Copy link

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.

@treitmayr treitmayr added the bug Something isn't working label Mar 17, 2024
@billyjbryant
Copy link
Contributor

Ankerctl does health check connections to the printer as it is an "always on" service. If the service is running, it is communicating to the printer to maintain connection so that when you load the website, it is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants