See the following 'test.py', we call client.makepasv() in socket, and then create_connection. Recursively calling makepasv() finally leads to core dumped.
System: Python 3.10.1, 3.11.0a3 ,master on Ubuntu 18.04
Reproduce step:
1. executing "python test.py"
2. If only TimeoutError is observed, just executing this code again. Maybe after 4 or 5 times, this program crashes Python interpreter.
test.py
===============================================
import socket
from test.test_ftplib import TestFTPClass,TIMEOUT
def test_makepasv():
host, port = TestFTPClass.client.makepasv()
conn = socket.create_connection((test_makepasv(), host), timeout=TIMEOUT)
conn.close()
===============================================
Error Message:
---------------------------------------------------
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/xxm/Desktop/compilers/cpython-main12-31/Lib/asyncore.py", line 90, in read
obj.handle_read_event()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxm/Desktop/compilers/cpython-main12-31/Lib/asyncore.py", line 427, in handle_read_event
Traceback (most recent call last):
.....
File "/home/xxm/Desktop/compilers/cpython-main12-31/Lib/test/test_ftplib.py", line 298, in run
return self._sock.recv_into(b)
^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out
Fatal Python error: _enter_buffered_busy: could not acquire lock for <_io.BufferedWriter name='<stderr>'> at interpreter shutdown, possibly due to daemon threads
Python runtime state: finalizing (tstate=0x0000556df3cfbe30)
Current thread 0x00007fb82ce69080 (most recent call first):
<no Python frame>
Extension modules: _testcapi (total: 1)
Aborted (core dumped)
-----------------------------------------------------
|