classification
Title: Recursive call crash module multiprocessing
Type: crash Stage:
Components: Library (Lib) Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: xxm
Priority: normal Keywords:

Created on 2021-01-31 05:26 by xxm, last changed 2021-01-31 05:26 by xxm.

Messages (1)
msg386008 - (view) Author: Xinmeng Xia (xxm) Date: 2021-01-31 05:26
The following code recursively calls function test_forkserver(). However, the output is not expected RecursionError(recursively calling) or OSError(too many open files). An unexpected EOFError ( inside module multiprocessing, not this code itself) is reported. According to the error message, Python interpreter seems to behavior abnormal on line 1, "import multiprocessing". I try other cases in my machine, multiprocessing module can work well. Only this case will crash module multiprocessing.

test.py
======================================
import multiprocessing
import os

def do(i):
      print(test_forkserver(), os.getpid())

def test_forkserver():
      mp = multiprocessing.get_context('forkserver')
      mp.Pool(2).map(do(mp), range(3))
if __name__ == '__main__':
      test_forkserver()
======================================

Attached output:
------------------------------------------------------------------
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/python3.10/lib/python3.10/multiprocessing/forkserver.py", line 258, in main
    fds = reduction.recvfds(s, MAXFDS_TO_SEND + 1)
  File "/usr/local/python3.10/lib/python3.10/multiprocessing/reduction.py", line 159, in recvfds
    raise EOFError
EOFError
...
------------------------------------------------------------------

System Info:
>>uname -a
Linux xxm 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

>>python -V
Python 3.10.0a4
History
Date User Action Args
2021-01-31 05:26:56xxmcreate