flyblade
flyblade

Reputation: 179

python script crashes after long time running

I have a python 2.7 script running on a Raspberry Pi 3.

class UIThread(threading.Thread):

   def __init__(self, threadID, name, counter, U):

    threading.Thread.__init__(self)

    self.threadID = threadID

    self.name = name

    self.counter = counter

    self.U = U

  def run(self):

    self.U.run()

def main():

  time.sleep(3)

  try:
     try:
         ###launch a UI running as background thread#####
         U = UIlib.UI()
         thread1 = UIThread(1, "UI", 1, U)
         thread1.daemon = True
         thread1.start()

     except:
         ###if there is no monitor, lanch a fake UI class#######
         U = UIlib.nomonitorUI()
         thread1 = UIThread(1, "NMUI", 1, U)
         thread1.daemon = True
         thread1.start()

         print "No Monitor detected"
         pass

    ####perform interaction with the BQ chip, contain a while true loop######
     char_balan(U)

  except:
    e = sys.exc_info()
    print e
    print "UI exit"

Basely what it does is to send a message through UART to a chip, obtain response message, update log files and print it onto the UI (a UI displayed on monitor created by python curses). It does this every 1 second.

The script has no bug running for 32 hours then it crashes. The UI is crashed and covered with error message:" cannot open shsh: error while loading shared libraries: libc.so.6 : cannot open shared object file..." I have googled this message but didn't find anything related to my python script

I have checked the memory status of the Raspberry Pi. The python process uses about 1/4 of the total memory at the 32th hour. So it is not the memory causing crash. Also, I have tried to run it without a monitor, which will launch a fake UI class without python.curses. same crash happened at the 32th hour.

Now, I am out of idea about why the script crashes.

Upvotes: 7

Views: 1449

Answers (1)

PyManiac
PyManiac

Reputation: 504

I have a stack of 8 raspberry pi's working as a seedbox. I had encountered the same error and the nearest official answer that i got from one of my raspi developer friend was that some older kernels have some incompatible bugs with the hardware. Updating to the latest Pixel version would solve your issue.

Upvotes: 1

Related Questions