7

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.

Steven Rumbalski
  • 44,786
  • 9
  • 89
  • 119
flyblade
  • 169
  • 1
  • 7
  • @StevenRumbalski yes, that is a typo. – flyblade Dec 16 '16 at 22:32
  • Which version of `libc` are you using, or is it `glibc`? – jmunsch Dec 16 '16 at 23:31
  • @jmunsch i dont know much about that. All I did was load a python script onto a raspberry pi 3 with Rasabian on it. And I didn't do anything about the linux system. – flyblade Dec 22 '16 at 23:58
  • check the output of `lsof -i $PID` every few hours, is it opening too many file descriptors? Is the error exit code number `24`? – jmunsch Dec 23 '16 at 00:10
  • Are you still having this issue? Do you have an answer to jmunsch's question? I can add a bounty to your question to make it get attention, but I want to make sure that you are around to respond to questions. – Steven Rumbalski Jan 03 '17 at 19:34
  • It appears the OP has abandoned this question and is not responding to clarifying questions in the comments. – Steven Rumbalski Jan 05 '17 at 21:56

1 Answers1

1

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.

PyManiac
  • 474
  • 4
  • 12
  • Thanks for your suggestion. I have solved the problem by changing my program's structure. even though the program does not crash now, but it runs much slower now. – flyblade Jun 02 '17 at 06:56