python - multiprocessing.Process hangs -
edited: question needs more info...
my code launches several process one:
def my_process_executor(req, semaphore=none): try: p = multiprocessing.process(target=do_stuff,args=(req,)) p.daemon = false p.start() p.join(max_seconds_waiting_for_process) if p.is_alive(): # time running, kill it! p.terminate() p.join() finally: if semaphore: semaphore.release()
when "semaphore" none, works fine, ton of concurrent processes.
but when "semaphore" has value:
semaphore = threading.boundedsemaphore(5)
sometimes subprocess never starts. despite process.is_alive() returns true, do_stuff doesn't anything.
any idea? what's happening here?
pay attention do_stuff not check semaphore. doesn't hangs due "red light" on semaphore.
code running on ubuntu 14.04.4 lts , python 2.7
Comments
Post a Comment