[issue45298] SIGSEGV when access a fork Event in a spawn Process

Keming report at bugs.python.org
Sun Sep 26 21:33:14 EDT 2021


New submission from Keming <kemingy94 at gmail.com>:

Code to trigger this problem:

```python
import multiprocessing as mp
from time import sleep


def wait_for_event(event):
    while not event.is_set():
        sleep(0.1)


def trigger_segment_fault():
    event = mp.get_context("fork").Event()
    p = mp.get_context("spawn").Process(target=wait_for_event, args=(event,))
    p.start()  # this will show the exitcode=-SIGSEGV
    sleep(1)
    print(p)
    event.set()
    p.terminate()


if __name__ == "__main__":
    trigger_segment_fault()
```

Accessing this forked event in a spawned process will result in a segment fault.

I have found a related report: https://bugs.python.org/issue43832. But I think it's not well documented in the Python 3 multiprocessing doc.

Will it be better to explicit indicate that the event is related to the start method context in the documentation?

----------
assignee: docs at python
components: Documentation
messages: 402687
nosy: docs at python, kemingy
priority: normal
severity: normal
status: open
title: SIGSEGV when access a fork Event in a spawn Process
type: crash

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45298>
_______________________________________


More information about the Python-bugs-list mailing list