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 時間目に発生しました。
さて、スクリプトがクラッシュする理由がわかりません。