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

2022-01-23 Thread Irit Katriel


Irit Katriel  added the comment:

Which python version and system are you seeing this on?

On 3.11 on a Mac I don't get a segfault but rather 

Process SpawnProcess-1:
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython/Lib/multiprocessing/process.py", line 
315, in _bootstrap
self.run()
^^
  File "/Users/iritkatriel/src/cpython/Lib/multiprocessing/process.py", line 
108, in run
self._target(*self._args, **self._kwargs)
^
  File "/Users/iritkatriel/src/cpython/tt.py", line 6, in wait_for_event
while not event.is_set():
  ^^
  File "/Users/iritkatriel/src/cpython/Lib/multiprocessing/synchronize.py", 
line 328, in is_set
with self._cond:

  File "/Users/iritkatriel/src/cpython/Lib/multiprocessing/synchronize.py", 
line 230, in __enter__
return self._lock.__enter__()
   ^^
  File "/Users/iritkatriel/src/cpython/Lib/multiprocessing/synchronize.py", 
line 95, in __enter__
return self._semlock.__enter__()
   ^
OSError: [Errno 9] Bad file descriptor


--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2021-09-26 Thread Keming


New submission from Keming :

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@python
components: Documentation
messages: 402687
nosy: docs@python, kemingy
priority: normal
severity: normal
status: open
title: SIGSEGV when access a fork Event in a spawn Process
type: crash

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com