[英]python script crashes after long time running
I have a python 2.7 script running on a Raspberry Pi 3. 我在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"
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). 基本上它的作用是通过UART向芯片发送消息,获取响应消息,更新日志文件并将其打印到UI(由python curses创建的监视器上显示的UI)。 It does this every 1 second. 它每1秒执行一次。
The script has no bug running for 32 hours then it crashes. 该脚本没有错误运行32小时然后崩溃。 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 UI崩溃并覆盖了错误消息:“无法打开shsh:加载共享库时出错:libc.so.6:无法打开共享对象文件...”我搜索了这条消息,但没有找到任何与我相关的信息python脚本
I have checked the memory status of the Raspberry Pi. 我检查了Raspberry Pi的内存状态。 The python process uses about 1/4 of the total memory at the 32th hour. python进程在第32小时使用大约1/4的总内存。 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. 此外,我试图在没有监视器的情况下运行它,这将启动一个没有python.curses的假UI类。 same crash happened at the 32th hour. 同样的事故发生在第32个小时。
Now, I am out of idea about why the script crashes. 现在,我不知道脚本崩溃的原因。
I have a stack of 8 raspberry pi's working as a seedbox. 我有一堆8个覆盆子pi作为种子箱工作。 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. 更新到最新的Pixel版本可以解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.