繁体   English   中英

python脚本在长时间运行后崩溃

[英]python script crashes after long time running

我在Raspberry Pi 3上运行了一个python 2.7脚本。

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"

基本上它的作用是通过UART向芯片发送消息,获取响应消息,更新日志文件并将其打印到UI(由python curses创建的监视器上显示的UI)。 它每1秒执行一次。

该脚本没有错误运行32小时然后崩溃。 UI崩溃并覆盖了错误消息:“无法打开shsh:加载共享库时出错:libc.so.6:无法打开共享对象文件...”我搜索了这条消息,但没有找到任何与我相关的信息python脚本

我检查了Raspberry Pi的内存状态。 python进程在第32小时使用大约1/4的总内存。 所以不是导致崩溃的内存。 此外,我试图在没有监视器的情况下运行它,这将启动一个没有python.curses的假UI类。 同样的事故发生在第32个小时。

现在,我不知道脚本崩溃的原因。

我有一堆8个覆盆子pi作为种子箱工作。 我遇到了同样的错误,我从我的一位开发者朋友那里得到的最接近的官方答案是,一些较旧的内核与硬件有一些不兼容的错误。 更新到最新的Pixel版本可以解决您的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM