Hi, I have made a simple experiment like below (I'm sorry you might have to re-edit the indents before running it),
I found deadlock when I send 'kill -15 pid' , I have to send 'kill -9 pid' to terminate it.
So I have a little bit worry about the atexit handler usage in od_mon_cli.Monitor.
import threading
import time
import signal
import sys
import atexit
lock = threading.Lock()
def handle_atexit():
dangeous when someone in same thread holding the lock!!
lock.acquire()
print "acquire lock in exit callback!"
lock.release()
Hi, I have made a simple experiment like below (I'm sorry you might have to re-edit the indents before running it), I found deadlock when I send 'kill -15 pid' , I have to send 'kill -9 pid' to terminate it. So I have a little bit worry about the atexit handler usage in od_mon_cli.Monitor.
import threading import time import signal import sys import atexit
lock = threading.Lock()
def handle_atexit():
dangeous when someone in same thread holding the lock!!
def do_exit(x,y): sys.exit(0)
atexit.register(handle_atexit) signal.signal(signal.SIGTERM, do_exit)
def non_release(): lock.acquire() while True: time.sleep(1) print "i'm having lock!" lock.release() ## outside of while loop
non_release()