Script crashing

After upgrading my BrewPi Spark, it has been crashign regularly. Here are some log files:

May 28 2018 06:08:26 Lost serial connection. Cannot write to serial
Terminating due to fatal serial error
May 28 2018 06:08:58 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 28 2018 06:08:58 Connecting to controller…
May 28 2018 06:08:58 Opening serial port
May 28 2018 06:08:58 Checking software version on controller…
May 28 2018 06:08:58 Found BrewPi v0.5.5 build 0.5.5-0-g3a3680b9c, running on a Particle p1 with a V3 shield on port socket://192.168.1.99:6666

May 28 2018 06:08:58 Warning: version number of local copy of logMessages.h does not match log version number received from controller.controller version = 4, local copy version = 3
May 28 2018 06:09:00 Controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 70.58
May 28 2018 06:09:52 Controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 70.59
May 28 2018 06:10:00 Serial Error: socket disconnected)
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 810, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 763, in run
self.__target(*self.__args, **self.__kwargs)
File “/home/brewpi/backgroundserial.py”, line 110, in __listen_thread
if self.writeln("") > 0:
File “/home/brewpi/backgroundserial.py”, line 56, in writeln
return self.write(data + “\n”)
File “/home/brewpi/backgroundserial.py”, line 59, in write
self.exit_on_fatal_error()
File “/home/brewpi/backgroundserial.py”, line 75, in exit_on_fatal_error
self.stop()
File “/home/brewpi/backgroundserial.py”, line 38, in stop
self.thread.join() # wait for background thread to terminate
File “/usr/lib/python2.7/threading.py”, line 940, in join
raise RuntimeError(“cannot join current thread”)
RuntimeError: cannot join current thread

May 28 2018 06:10:00 Lost serial connection. Cannot write to serial
Terminating due to fatal serial error
May 28 2018 06:10:32 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 28 2018 06:10:32 Connecting to controller…
May 28 2018 06:10:32 Opening serial port
May 28 2018 06:10:32 Checking software version on controller…
May 28 2018 06:10:32 Found BrewPi v0.5.5 build 0.5.5-0-g3a3680b9c, running on a Particle p1 with a V3 shield on port socket://192.168.1.99:6666

May 28 2018 06:10:32 Warning: version number of local copy of logMessages.h does not match log version number received from controller.controller version = 4, local copy version = 3
May 28 2018 06:11:03 Serial Error: socket disconnected)
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 810, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 763, in run
self.__target(*self.__args, **self.__kwargs)
File “/home/brewpi/backgroundserial.py”, line 110, in __listen_thread
if self.writeln("") > 0:
File “/home/brewpi/backgroundserial.py”, line 56, in writeln
return self.write(data + “\n”)
File “/home/brewpi/backgroundserial.py”, line 59, in write
self.exit_on_fatal_error()
File “/home/brewpi/backgroundserial.py”, line 75, in exit_on_fatal_error
self.stop()
File “/home/brewpi/backgroundserial.py”, line 38, in stop
self.thread.join() # wait for background thread to terminate
File “/usr/lib/python2.7/threading.py”, line 940, in join
raise RuntimeError(“cannot join current thread”)
RuntimeError: cannot join current thread

May 28 2018 06:11:04 Lost serial connection. Cannot write to serial
Terminating due to fatal serial error
May 28 2018 06:11:36 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 28 2018 06:11:36 Connecting to controller…
May 28 2018 06:11:36 Opening serial port
May 28 2018 06:11:36 Checking software version on controller…
May 28 2018 06:11:36 Found BrewPi v0.5.5 build 0.5.5-0-g3a3680b9c, running on a Particle p1 with a V3 shield on port socket://192.168.1.99:6666

May 28 2018 06:11:36 Warning: version number of local copy of logMessages.h does not match log version number received from controller.controller version = 4, local copy version = 3
May 28 2018 06:11:37 Controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 70.6
May 28 2018 06:12:04 Error: Received invalid message on socket: getSerialDevicesAvailable
May 28 2018 06:12:46 Controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 70.61
May 28 2018 06:13:37 Serial Error: socket disconnected)
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 810, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 763, in run
self.__target(*self.__args, **self.__kwargs)
File “/home/brewpi/backgroundserial.py”, line 110, in __listen_thread
if self.writeln("") > 0:
File “/home/brewpi/backgroundserial.py”, line 56, in writeln
return self.write(data + “\n”)
File “/home/brewpi/backgroundserial.py”, line 59, in write
self.exit_on_fatal_error()
File “/home/brewpi/backgroundserial.py”, line 75, in exit_on_fatal_error
self.stop()
File “/home/brewpi/backgroundserial.py”, line 38, in stop
self.thread.join() # wait for background thread to terminate
File “/usr/lib/python2.7/threading.py”, line 940, in join
raise RuntimeError(“cannot join current thread”)
RuntimeError: cannot join current thread

May 28 2018 06:13:38 Lost serial connection. Cannot write to serial
Terminating due to fatal serial error
May 28 2018 06:14:10 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 28 2018 06:14:10 Connecting to controller…
May 28 2018 06:14:10 Opening serial port
May 28 2018 06:14:10 Checking software version on controller…
May 28 2018 06:14:10 Found BrewPi v0.5.5 build 0.5.5-0-g3a3680b9c, running on a Particle p1 with a V3 shield on port socket://192.168.1.99:6666

May 28 2018 06:14:10 Warning: version number of local copy of logMessages.h does not match log version number received from controller.controller version = 4, local copy version = 3
May 28 2018 06:14:12 Controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 70.62
May 28 2018 06:14:27 Error: Received invalid message on socket: getSerialDevicesAvailable

Just checked the upgrade. Seems it failed when trying to stash a config.example file. I ran the update again and selected N when asked to stash the file. Will check again later to see if the BrewPi is stable.

I’m still having problems with the script crashing regularly. Here is more log information:

May 28 2018 17:34:17 Controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 75.24
May 28 2018 17:34:18 Controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 75.24
May 28 2018 17:34:19 Controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 75.24
May 28 2018 17:34:19 Controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 75.24
May 28 2018 17:34:20 Controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 75.24
May 28 2018 17:34:20 Serial Error: socket disconnected)
May 28 2018 17:34:20 Controller debug message: INFO MESSAGE 12: Received new setting: beerSet = 75.24
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 810, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 763, in run
self.__target(*self.__args, **self.__kwargs)
File “/home/brewpi/backgroundserial.py”, line 110, in __listen_thread
if self.writeln("") > 0:
File “/home/brewpi/backgroundserial.py”, line 56, in writeln
return self.write(data + “\n”)
File “/home/brewpi/backgroundserial.py”, line 59, in write
self.exit_on_fatal_error()
File “/home/brewpi/backgroundserial.py”, line 75, in exit_on_fatal_error
self.stop()
File “/home/brewpi/backgroundserial.py”, line 38, in stop
self.thread.join() # wait for background thread to terminate
File “/usr/lib/python2.7/threading.py”, line 940, in join
raise RuntimeError(“cannot join current thread”)
RuntimeError: cannot join current thread

May 28 2018 17:34:21 Lost serial connection. Error: Could not open port socket://192.168.1.99:6666: [Errno 111] Connection refused)
Terminating due to fatal serial error

I am now receiving these messages in logs

May 30 2018 11:47:46 Warning: Cannot receive version number from controller. This could be because your controller is not programmed or running a very old version of BrewPi.This script will now exit.
May 30 2018 11:48:18 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 30 2018 11:48:18 Connecting to controller…
May 30 2018 11:48:18 Opening serial port
May 30 2018 11:48:18 Checking software version on controller…
May 30 2018 11:48:28 Warning: Cannot receive version number from controller. This could be because your controller is not programmed or running a very old version of BrewPi.This script will now exit.
May 30 2018 11:49:00 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 30 2018 11:49:00 Connecting to controller…
May 30 2018 11:49:00 Opening serial port
May 30 2018 11:49:01 Checking software version on controller…
May 30 2018 11:49:11 Warning: Cannot receive version number from controller. This could be because your controller is not programmed or running a very old version of BrewPi.This script will now exit.
May 30 2018 11:49:43 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 30 2018 11:49:43 Connecting to controller…
May 30 2018 11:49:43 Opening serial port
May 30 2018 11:49:43 Checking software version on controller…
May 30 2018 11:49:53 Warning: Cannot receive version number from controller. This could be because your controller is not programmed or running a very old version of BrewPi.This script will now exit.
May 30 2018 11:50:25 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 30 2018 11:50:25 Connecting to controller…
May 30 2018 11:50:25 Opening serial port
May 30 2018 11:50:25 Checking software version on controller…
May 30 2018 11:50:35 Warning: Cannot receive version number from controller. This could be because your controller is not programmed or running a very old version of BrewPi.This script will now exit.
May 30 2018 11:51:07 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 30 2018 11:51:07 Connecting to controller…
May 30 2018 11:51:07 Opening serial port
May 30 2018 11:51:07 Checking software version on controller…
May 30 2018 11:51:17 Warning: Cannot receive version number from controller. This could be because your controller is not programmed or running a very old version of BrewPi.This script will now exit.
May 30 2018 11:51:50 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 30 2018 11:51:50 Connecting to controller…
May 30 2018 11:51:50 Opening serial port
May 30 2018 11:51:50 Checking software version on controller…
May 30 2018 11:52:00 Warning: Cannot receive version number from controller. This could be because your controller is not programmed or running a very old version of BrewPi.This script will now exit.
May 30 2018 11:52:32 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 30 2018 11:52:32 Connecting to controller…
May 30 2018 11:52:32 Opening serial port
May 30 2018 11:52:32 Checking software version on controller…
May 30 2018 11:52:42 Warning: Cannot receive version number from controller. This could be because your controller is not programmed or running a very old version of BrewPi.This script will now exit.
May 30 2018 11:53:14 Notification: Script started for beer ‘Belgian Dark Strong Ale’
May 30 2018 11:53:14 Connecting to controller…
May 30 2018 11:53:14 Opening serial port
May 30 2018 11:53:14 Checking software version on controller…
May 30 2018 11:53:24 Warning: Cannot receive version number from controller. This could be because your controller is not programmed or running a very old version of BrewPi.This script will now exit.

Is it possible to get support for this problem? For a week now the BrewPi Spark has been continuously disconnecting. I’ve tried through the forums and by selecting Contact Us from the store, no response from either.

Hi, sorry for the late reply. Here are some things to check:

  • Are you running the latest version of the docker container?
  • What is the IP address shown on the display of the Spark?
  • What is the state of the LED on the Spark?

Is the Spark far away from your router?

I am not sure how to check the version of the docker container. I’m new to using docker. I went through the update steps about a week ago, both the script and firmware were updated. That is when the connection problems started. From the end of December 2017 to last week the BrewPi spark was very stable.

The ip address is 192.168.1.99

The LED is light blue very slowly blinking
The spark is a few inches from the RaspberryPi that is reading the information. It is about 15 feet from the router. There is also 2 ip cameras and a tilt int he same room that dont have connection problems, and an extender a few feet away.

Thanks for your help.

If the LED is slowly breathing cyan, the spark as a good connection.
If you say you updated the script manually, you are probably not using docker are you?

Do you have portainer running on he pi? You can recreate an existing container with the latest image from the portainer web interface.

I am using portainer. I updated in the console in portainer by running ~/brewpi-tools/python updater.py

We release a new docker container that contains the latest version of the code each time the code updates.
Your settings are persisted outside of the container.

The best approach to update is therefore to get the latest version of the container, instead of running an update inside an existing container.
The easiest way to update the container is let portainer re-create it. Browse to the BrewPi container and click ‘recreate’. Leave ‘pull latest image’ ticked.

Ok, updated using that method. I’ll let you know if there are any more connection problems.

This helped me out as well and the spark connected immediately with the new brewpi container.