-
-
Save pitrou/d9784d5ec679059cd02fce4b38ea2fa6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import faulthandler | |
from queue import Queue | |
import multiprocessing | |
import os | |
import sys | |
import threading | |
import time | |
if __name__ == "__main__": | |
queue = Queue() | |
def consume(): | |
while True: | |
print("Consumed:", queue.get()) | |
thread = threading.Thread(target=consume) | |
thread.start() | |
def proc(): | |
faulthandler.dump_traceback_later(1.0, exit=True) | |
for i in range(10000): | |
queue.put(i) | |
p = multiprocessing.Process(target=proc) | |
p.start() | |
p.join() | |
if p.exitcode != 0: | |
print("Child process failed!") | |
os._exit(0) | |
print("Not hanging yet", i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment