OctoPi losing network connection mid-print

What is the problem?
OctoPi loses connection after print starts; can't even ping the IP. Serial connection stays solid and prints complete successfully. This follows many successful prints that maintain network connection all the way through; the only recent changes are the addition of the RPi camera and a change in power supply; I added a 5.1V, 3A buck converter to eliminate undervoltage issues. Those have been solved.
What did you already try to solve it?
Nothing. I just notice the connection vanishing. I usually notice the camera feed disappearing first. The print from last night lost connection after 21 minutes (20:16 start, 20:31 loss of network connection).

EDIT: I just lost connection again after visiting the GCode Viewer and Terminal tabs. I don't know whether that's related, but I definitely did not visit the Control tab. Server is now offline and I can't reconnect. Can't ping the IP address. All other network devices are fine.
Logs (syslog, dmesg, ... no logs, no support)
Both octoprint and serial logs are here:
logs.zip (346.9 KB)

The serial log is just an excerpt because the print was very long and the log was HUGE.

Of note are these lines from octoprint.log:

2020-02-18 20:37:31,214 - octoprint.util.connectivity_checker - INFO - Connectivity changed from online to offline
2020-02-18 20:48:46,940 - octoprint.server.util.sockjs - INFO - Client connection closed: ::ffff:10.0.0.152

Additional information about your network (Hardware you are trying to connect to, hardware you are trying to connect from, router, access point, used operating systems, ...)
OctoPrint 1.3.12, OctoPi 0.17.0, Windows 10 PC, static IP assigned to both by router.

1 Like

Two weeks seems like forever ago... I've since upgraded the board to an SKR v1.3 and I'm now running Marlin 2.0.4.4. The network connectivity issues are exactly as they were before. Usually about 5-10 minutes into the start of a print while monitoring it in the browser, OctoPi loses connectivity and I can't reconnect until a power cycle (so, after the print is completed). Meanwhile, the print continues as if nothing is wrong. I can't stop the print locally through the controller because the printer treats it as a "pause" and then immediately resumes the print. If I have print troubles after the network disconnect, the only thing I can do is shut off the power supply.

Yesterday I experienced an SD corruption problem in OctoPi... the RPi went dead/non-responsive. I flashed a new card and got OctoPi up and running again and silently hoped that the network connectivity problem would go away... but it did not. I have a long print going this morning and just lost connection to OctoPi. I can't ping it.

What Pi are you running?
also look in /var/log/syslog to see what you see about the wireless connection as that is logged there. The Wifi/Network is not controlled by Octoprint, it's the Linux (Raspbian) system

It's a 3B.

I'll have a look, thanks.

I would love to do this... but I've been unsuccessful.

I can SSH into the RPi and actually bring up the file. I can check it out in Nano, a handful of lines at a time. I've installed Samba and can access most places on the RPi, but not the /var directory. While SSH'd into the RPi, I have tried to copy the syslog file(s) to a directly I can access, but it's not working.

I'd like to be able to take a close look at this file, but I can't get it anywhere useful. Attached is a screen shot featuring my most recent failures.

Also worth noting: I don't know Linux.

Ah. once you are ssh'd in as pi, do a sudo cp /var/log/syslog . make sure to put the . there as it tells it to copy the file to where you are at. Next, do sudo chown pi:pi syslog then to view the file, do more syslog that will display the file one page at a time

Maybe a three-step approach:

# On the Pi itself
sudo cp /var/log/syslog /home/pi/syslog.txt
sudo chown pi:pi /home/pi/syslog.txt
cat ~/syslog.txt
# From your macOS workstation
scp pi@octopi.local:~/syslog.txt ./Desktop/.

The last line would transfer it over to your Desktop on your macOS computer, for example.

1 Like

That worked, thanks! I'll repeat for the remaining syslog.* files as my connection has actually been rock-solid in the last couple of days. My last dropped connection was around the end of last week, I think. I'll post the results.

I’m having a very similar issue with mine as well.
-3B with heat sink and dual fans

  • serial connection is fine - I’ve never had a print issue
  • IP connection is fine for a long time then peters out for a while, then comes back. No rhyme or reason
  • Power-cycling the rpi sometimes fixes the issue, but usually not
  • I run an MQTT server on the same box, so I know when I lose connectivity because I get errors from another app looking for the MQTT connection

I’m suspecting a WiFi issue of some sort but have never had the motivation to track it down. I may try hard wiring it and see if the issue persists.

Well, once my IP connection is gone, it's gone for good. Or, until I cycle the power, and then it comes back immediately.

My Pi is in an outbuilding, but it's closer to my router than a lot of other wireless devices in my network. And if it were a range issue, I'd expect the connection to come back randomly and not reconnect so predictably on reboot.

Now that I've added a Z-wave plug to my printer's power supply, it's less of an issue because--as long as I'm not printing--I can just cycle power and get my connection back. And in fact, I haven't lost the connection in almost a week, which is weird but good.

I'm having this issue as well.

  • Wifi works fine on boot and well into a new job. Both the ip address (with a dedicated DHCP reservation) and the hostname resolve.
  • Wifi loses connection after 5-10 minutes.
  • Ping is 100% packet loss to both ip (and of course) the hostname.

Here's the wierd thing: if I plug cat5 into eth0, not only does the ethernet cable work, and I can ping and load OctoPrint, but the wifi starts working again also!

I have the same problem. All works fine, but once I print (not always) wifi connection breaks (octopi continues printing just fine)

as a workaround i have a shellscript via cron that pings my router and does updown|ifup to restart the wifi networ connection is lost. That helps but its certainly not a nice workaround.

I suspect that the webcam streaming (either via octopi webclient or via the cura octopi plugin) could be the culprit. I need to test it but it seems it only happens, when the webcam is watched.

any thoughts?

I also have the same problem, with the pi falling off the wifi after some period of time, but not actually crashing.

I am actually monitoring the camera with my Blue Iris software, so my webcam would always be streaming. I have multiple wired pi's (2,3b+,4b) and a wifi 3b+ and zero, but this is my only wifi pi4, and the only device experiencing disconnects.

I haven't found anything in the logs but these are the changes I've made so far:

  1. make sure wpa_supplicant.conf has "country=US" (I think it did already and I don't think it made a difference).

  2. Investigate network and signal strenth: I have a unifi system, but no irregularities appear in the logs and there is an AP close to the pi so signal isn't an issue.

  3. Investigate Power Save Mode
    in an ssh terminal: journalctl | grep brcmfmac
    this does show a log that says that power management is disabled
    However, if you query the wlan0 interface directly with "iw wlan0 get power_save" then it says power save is turned on.
    So I used "iw wlan0 set power_save off"

  4. Give the interface a static IP fallback in /etc/dhcpcd.conf:
    profile static_wlan0
    static ip_address=192.168.1.73/24
    static routers=192.168.1.1
    static domain_name_servers=192.168.1.1

fallback to static profile on wlan0

interface wlan0
fallback static_wlan0

This is my most recent change and not long after I saved the file I lost my ssh connection, so I will need to pull the plug and reboot one more time to make the config kick in.

I haven't tried plugging an ethernet cable directly into the Pi yet (it would have to be a long one!) but I can confirm that the issue can also occur when I am not in the middle of a print. During printing over the last couple of weeks it has happened on all but one print. Sometimes it cuts out within the first few minutes, other times it can be hours into the print until it happens.

I've also ruled out a wifi connection issue. I wrote a cron job for the Pi to constantly check wifi signal strength and log it to a file. Whenever the issue occurs there is no change in signal strength. It just turns off.

So, to put it plainly, I got nothin'.

Hopefully some guru will come and save the day but until then I'll keep rebooting by power cycling the Pi.

PS - I'm going to start a new thread in a different section, but FWIW my Octoprint server will no longer start. This just happened within the last day or so. Ugh.

Edit: problem solved. My SD card was full.

UPDATE

I may regret writing this, but about 10 days ago I decided to try out Home Assistant and built it into its own RPi4. It has an MQTT Broker add-on, so I got that running and then shut down the Mosquitto service running on my OctoPi box. Ever since then I've not had any disconnections.

Maybe there was some sort of network issue when the MQTT broker was running? If so the logs I looked at never revealed it.

If it flares up again I'll report back, but if you're still having the issue I'd take a look at other processes/services that are running on your OctoPi and consider running nothing but OctoPrint on that box.

1 Like

Has anyone found a solution?
Have been looking everywhere and starting to get frustrated...
I am experiencing the same issue, after some time my p4 loses the connection and i cannot control it anymore from the browser or ssh into it, sometimes power cycling the p4 works sometimes it doesn't.
I tried re-flashing the octopi image and the issue keep happening.
any help would be appreciated

The Pi4 tend to get quite warm. Do you have sufficient cooling?

yes, I have been running it with the same setup since last October, I have heatsinks, a fan blowing directly on it from the top and it's in an enclosure with two other fans for air circulation:
only in the last couple weeks it started acting up

Same issue. Pi 4 dedicated to Octopi only. Also using Unifi hardware. Unifi shows strong signal strength and device active/online even though Octoprint is not responsive.. Workaround without rebooting the Pi mid-print by issuing or forcing the client to "reconnect" via Unifi app. Everything comes back..