Hello,
I am getting the occasional broken pipe error which is crashing my program.
I searched the community and found one existing topic but it seemed to be caused by widgets accessing data that does not exist. I have confirmed I do not have extra widgets on either my app or desktop gui.
- Hardware model: Raspberry pi 0w
- Smartphone: Android
- Blynk server: Blynk.cloud:443
- Blynk Library version: 1.0.0
The exact error I get is:
Exception in thread Thread-2:
Sep 20 06:59:00 raspberrypi python3[414]: Traceback (most recent call last):
Sep 20 06:59:00 raspberrypi python3[414]: File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
Sep 20 06:59:00 raspberrypi python3[414]: self.run()
Sep 20 06:59:00 raspberrypi python3[414]: File "/usr/lib/python3.7/threading.py", line 865, in run
Sep 20 06:59:00 raspberrypi python3[414]: self._target(*self._args, **self._kwargs)
Sep 20 06:59:00 raspberrypi python3[414]: File "/home/pi/sw/chicken-gate/gate.py", line 30, in main
Sep 20 06:59:00 raspberrypi python3[414]: self.process_inputs()
Sep 20 06:59:00 raspberrypi python3[414]: File "/home/pi/sw/chicken-gate/gate.py", line 41, in process_inputs
Sep 20 06:59:00 raspberrypi python3[414]: if self.send_new_position_1hz():
Sep 20 06:59:00 raspberrypi python3[414]: File "/home/pi/sw/chicken-gate/gate.py", line 48, in send_new_position_1hz
Sep 20 06:59:00 raspberrypi python3[414]: self.run_position_fbk_cb()
Sep 20 06:59:00 raspberrypi python3[414]: File "/home/pi/sw/chicken-gate/gate.py", line 98, in run_position_fbk_cb
Sep 20 06:59:00 raspberrypi python3[414]: cb(self.get_position())
Sep 20 06:59:00 raspberrypi python3[414]: File "/home/pi/sw/chicken-gate/api.py", line 31, in write_gate_status
Sep 20 06:59:00 raspberrypi python3[414]: Api.blynk.virtual_write(3, status_in_percent)
Sep 20 06:59:00 raspberrypi python3[414]: File "/home/pi/sw/chicken-gate/.env/lib/python3.7/site-packages/BlynkLib.py", line 84, in virtual_write
Sep 20 06:59:00 raspberrypi python3[414]: self._send(MSG_HW, 'vw', pin, *val)
Sep 20 06:59:00 raspberrypi python3[414]: File "/home/pi/sw/chicken-gate/.env/lib/python3.7/site-packages/BlynkLib.py", line 117, in _send
Sep 20 06:59:00 raspberrypi python3[414]: self._write(msg)
Sep 20 06:59:00 raspberrypi python3[414]: File "/home/pi/sw/chicken-gate/.env/lib/python3.7/site-packages/BlynkLib.py", line 249, in _write
Sep 20 06:59:00 raspberrypi python3[414]: self.conn.write(data)
Sep 20 06:59:00 raspberrypi python3[414]: File "/usr/lib/python3.7/ssl.py", line 930, in write
Sep 20 06:59:00 raspberrypi python3[414]: return self._sslobj.write(data)
Sep 20 06:59:00 raspberrypi python3[414]: BrokenPipeError: [Errno 32] Broken pipe
The error occurs when I open/close a gate and update the gate position at 1hz. The updates stop once the gate is fully open/closed. This happens twice a day. Other than that, I push an “UpTime” variable so I can see it increment and know that everything is still working. I push this every 5s.
I am particularly confused by the low occurrence rate of this. It will be fine for days, then suddenly crash. As far as I can understand, the rates that I am pushing data are pretty typical. Would this be the expected error if data was pushed too fast? eg if the gate position and uptime were pushed too close together?
I tried catching this error and ignoring it but then my data no longer gets pushed to the cloud. In the below code, api.run()
runs the Blynk
and BlynkTimer
objects.
while True:
try:
api.run()
except IOError as e:
if e.errno == errno.EPIPE:
pass
Has anyone else been through this? Any ideas?
thanks,
Geoff