Arksine / moonraker

Web API Server for Klipper
https://moonraker.readthedocs.io
GNU General Public License v3.0
1.05k stars 404 forks source link

Using the Fluidd UI and moonraker, comms to the Pi get blocked all the time #157

Closed vgroenewold closed 3 years ago

vgroenewold commented 3 years ago

This seems like a buffer issue, but I often (few times a day) have the problem that I execute something on the Fluidd UI (like bed leveling, or adjusting Z while printing, or... seems rather random) and the UI becomes unresponsive. I can still click around, but commands are not being send to the Pi nor received, prints always continue so my guess is that the Pi becomes too busy. But how can I diagnose that or even solve it?

edit: I did some extra diagnosis with Htop running at the same time in a shell and that simply freezes as well for instance when the print starts for heating up and leveling. No comms whatsoever during that time, is it moonraker blocking that maybe? Resources looked totally fine. The only way to get responsiveness back immediately it to disconnect the Pi from the printer.

Thanks

Arksine commented 3 years ago

This sounds like a Kernel or driver issue. Even at 100% load Moonraker shouldn't be able to freeze ssh on a multicore system.

If you can reproduce this, disconnect the printer, then grab /tmp/moonraker.log (give it 30 seconds or so) it might provide some insight. When Klippy enters the shutdown state Moonraker dumps its own process usage stats to the log.

vgroenewold commented 3 years ago

Thanks, I'll try to recreate it and see if I can get a relevant section from the log.

vgroenewold commented 3 years ago

Mm, nothing really special, I do see a wait command: 2021-05-05 19:08:04,006 [moonraker.py:wait()] - Request 'gcode/script' pending: 60.00 seconds

That was about the time it was not responding this time. I'll add more logs to this reply when I investigate further.

Little further up I also see this one, with a failure to connect and two wait commands;

2021-05-05 18:49:50,004 [websockets.py:add_websocket()] - New Websocket Added: 1753101072 2021-05-05 18:50:00,798 [file_manager.py:get_file_list()] - Updating File List ... 2021-05-05 18:50:31,265 [shell_command.py:_check_proc_success()] - Command (/home/pi/moonraker-env/bin/python /home/pi/$2021-05-05 18:50:31,271 [file_manager.py:get_file_list()] - Updating File List ... 2021-05-05 18:51:40,053 [moonraker.py:wait()] - Request 'gcode/script' pending: 60.00 seconds 2021-05-05 18:52:40,054 [moonraker.py:wait()] - Request 'gcode/script' pending: 120.00 seconds 2021-05-05 19:03:36,460 [file_manager.py:get_file_list()] - Updating File List ... 2021-05-05 19:03:37,576 [moonraker.py:on_connection_closed()] - Klippy Connection Removed 2021-05-05 19:03:37,652 [websockets.py:build_error()] - JSON-RPC Request Error: 503 Klippy Host not connected Traceback (most recent call last): File "/home/pi/moonraker/moonraker/websockets.py", line 149, in execute_method result = await method(ws, *args, **kwargs) File "/home/pi/moonraker/moonraker/websockets.py", line 219, in func user=ws.current_user)) File "/home/pi/moonraker/moonraker/moonraker.py", line 422, in make_request return await self._request_standard(web_request) File "/home/pi/moonraker/moonraker/moonraker.py", line 476, in _request_standard return await base_request.wait() File "/home/pi/moonraker/moonraker/moonraker.py", line 622, in wait raise self.response utils.ServerError: Klippy Host not connected 2021-05-05 19:03:38,835 [moonraker.py:connect()] - Klippy Connection Established 2021-05-05 19:03:38,860 [moonraker.py:_check_ready()] -

Arksine commented 3 years ago

I'll need the full log to be able to help diagnose any potential issues. Thanks.

vgroenewold commented 3 years ago

Ok, sorry for that, let me finish a print and then I'll try to force the error and send the entire log. Thanks for the help!

vgroenewold commented 3 years ago

Sorry for the long file, but this is the one from today. I at least experience 2 "disconnects" just during printing. I'm also wondering, even though my Pi has good wifi, if it may be a connection problem there.

klippy.log

Arksine commented 3 years ago

Thanks, however moonraker.log is the one I require. I might be able to glean some info from Klippy.log, but if there is a specific issue with moonraker it will be in there.

vgroenewold commented 3 years ago

Oh wow, must have been a long day today. Let me try that again tomorrow, sorry about that.

vgroenewold commented 3 years ago

Alright, here is the new one. During the print I saw Klippy not updating for a big period towards the end; moonraker.log

Arksine commented 3 years ago

Looks like the websocket connection was dropped. Since it occured in the middle of a status update some exceptions are logged while it tries to write to a closed socket, which is to be expected.

My guess is that its some kind of networking issue.

vgroenewold commented 3 years ago

Ok, interesting. My pi is connected to wifi which is strong here, but maybe there's an issue there. I might try to hook it up via cable to check. Thanks!

QGB commented 1 year ago

moonraker How to execute gcode wait to finish blocking call?