Files
exo/throwaway_tests/segfault_multiprocess.py
Andrei Cravtov 8d2536d926 Implemented basic discovery library in Rust + python bindings
Co-authored-by: Gelu Vrabie <gelu@exolabs.net>
Co-authored-by: Seth Howes <sethshowes@gmail.com>
Co-authored-by: Matt Beton <matthew.beton@gmail.com>
2025-07-23 13:11:29 +01:00

31 lines
720 B
Python

import ctypes;
from multiprocessing import Process
def trigger_segfault():
ctypes.string_at(0)
def subprocess_main(id: int):
print(f"SUBPROCESS {id}: PROCESS START")
trigger_segfault()
print(f"SUBPROCESS {id}: PROCESS END")
def main():
"""This code tests that a master process is not brought down by
segfaults that occur in the child processes
"""
print("MASTER: PROCESS START")
procs: list[Process] = []
for i in range(0, 10):
p = Process(target=subprocess_main, args=(i,))
procs.append(p)
p.start()
print("MASTER: JOINING SUBPROCESSES")
for p in procs:
p.join()
print("MASTER: PROCESS END")
if __name__ == "__main__":
main()