Print lagging when printing with Octoprint

What is the problem?

I recently got a Prusa MK4, got it hooked up to octoprint and now I am having issues with printing without the printer lagging. it seems my raspi is not able to keep up with the Gcode it is sending to my printer. Network 0 upload is idling at 65 Mb/s and spiking up to 450 Mb/s.

What did you already try to solve it?

I think I narrowed it down to some network spikes on my pi, I tried safe mode and it solved the problem.
I also tried another USB cable, power supply, different resolutions and frame rates.

Have you tried running in safe mode?

Yes I have.

Did running in safe mode solve the problem?

Yes it did.

Systeminfo Bundle

Right Here:
octoprint-systeminfo-20240320233615.zip (195.8 KB)

Additional information about your setup

OctoPrint version: 1.9.3
OctoPi version: Build 2023.10.09.154319 with "camera-streamer", based on OctoPi 1.0.0, running on Raspberry Pi 4 Model B Rev 1.4
Printer: Prusa MK4
Firmware: 5.1.3 + 13503
Browser: Firefox
Operating system: Windows 11

I there is any more information I can provide I'm glad to!

Network has nothing to do with the printer. The pi sends the gcode over the USB cable.
I can't remember which plugin it is but there have been a couple threads on a plugin that causes the issue, hence why in safe mode it prints fine

Looking at your log...

There are a couple places where "OctoEverywhere" is timing out. ANd there is something that seems to be called "ikea_tradfri" that is having a hard exception

I would start with disabling these and see if your issue goes away. Then add one back and test again. Once you figure out which it is, look at the settings and logs to workout what the issue is.

Disabling Octoeverywhere seemed to fix the problem of the print slowing down and showing blobs.
SInce there aren't many settings I can change within the Octoeverywhere plugin I took a look at the logs, I see things are going wrong but I don't know what to do about them.
I found it saying something to do with the websocket an doing a lot of ThreadDumps, and also with not being able to identify an image file on later logs. I tried reinstalling the plugin but to no avail.

Could you maybe take a look? I included the log.
octoprint Log.log (1.0 MB)

Not sure if this will help but an issue posted on Octoeverywhere seems to say that this issue happens when the websocckets version is above 1.4.0.x

I don't use OctoEverywhere so I am not very knowledgeable in relation to this plugin. Maybe take closer look at the source site issues area here. Might be worth a post there too.

Use what your log says to research the issue.

Your log clearly states this as its issue:

2024-03-20 02:40:09,872 - octoprint.plugins.octoeverywhere - ERROR - OctoEverywhere Ws error: ping/pong timed out
2024-03-20 02:40:09,875 - websocket - ERROR - ping/pong timed out - goodbye
2024-03-20 02:40:09,876 - octoprint.plugins.octoeverywhere - INFO - Service websocket closed.
2024-03-20 02:40:09,877 - octoprint.plugins.octoeverywhere - INFO - Disconnected from OctoEverywhere, server con wss://lon.octoeverywhere.com/octoclientws[6]
2024-03-20 02:40:09,877 - octoprint.plugins.octoeverywhere - INFO - Closing all open web stream sockets (0)
2024-03-20 02:40:09,878 - octoprint.plugins.octoeverywhere - INFO - Sleeping for 8 seconds before trying again.
2024-03-20 02:40:17,887 - octoprint.plugins.octoeverywhere - INFO - Attempting to use lowest latency server: wss://lon.octoeverywhere.com/octoclientws
2024-03-20 02:40:17,889 - octoprint.plugins.octoeverywhere - INFO - Attempting to talk to OctoEverywhere, server con wss://lon.octoeverywhere.com/octoclientws[7] wsId:2704232920
2024-03-20 02:40:18,005 - octoprint.plugins.octoeverywhere - INFO - Connected To OctoEverywhere, server con wss://lon.octoeverywhere.com/octoclientws[7]. Starting handshake...
2024-03-20 02:40:18,127 - octoprint.plugins.octoeverywhere - INFO - Handshake complete, server con wss://lon.octoeverywhere.com/octoclientws[7], successfully connected to OctoEverywhere!

Be sure to let us know what you find and how you solve the issue. I know I have seen others with similar issues in there logs.

I think I have found the problem.
Octoeverywhere wasn't able to retrieve a stream and snapshot from my server because some fields weren't filled in right.
In the Camera Streamer settings I changed this:

to this:

And it seems to have fixed the problem.
I noticed in the web version of Octoeverywhere that it wasn't showing a snapshot and video so I went looking for some settings and changed these fields. The snapshot showed right up and the stream was visible in the quick view as well.

I don't really understand why it fixed all my problems but it did and I am happy about it, I wanted to let you know and if there are other people experiencing the same problem they can find it here.

Thanks for you help!

1 Like

This is great to hear, glad to see you got it worked out. Others I am sure will benefit.

The likely cause for the issues is that when there is a request to a seperate system, the plugin must be willing to wait some period of time for that other system to respond. At least in the simple synchronous request response model. While the system waits on the response, the rest of the code has to wait. And that means that if it's time to send the next few lines of GCode to the printer, that will have to wait for either the timeout or the actual response from the request to complete. If the response is slow for some reason that could cause lag in the general operation of OctoPrint. If it never comes back, that means that everything is waiting on this one request to timeout. What is a reasonable time to wait for a response? Well it sounds like not a lot of thought went into that for this part of the plugin. There are ways to code around this but it may not be something that is a big enough issue for the developer to give attention to at this time.

Keep in mind that if you have network trouble or something of that nature your issue is most likely going to come back until that is fixed.

I found out that I was looking in the wrong place...
It seems that the URLs for the camera-streamer were incorrect.
So I was still on the old webcam stream which is way more taxing than the webRTC stream.
I reinstalled Camera Streamer Control and now it's working like a charm!

Soooo totally user error on my behalve.
This is what the URLs should be:

So Octoeverywhere couldn't get the right stream, and took up a lot of resources trying to make it work I guess.

At least I learned a lot!

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.