This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Recursively calling makepasv() finally leads to core dumped.
Type: crash Stage:
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: xxm
Priority: normal Keywords:

Created on 2021-12-31 05:45 by xxm, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg409408 - (view) Author: Xinmeng Xia (xxm) Date: 2021-12-31 05:45
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)
-----------------------------------------------------
History
Date User Action Args
2022-04-11 14:59:54adminsetgithub: 90369
2021-12-31 05:45:05xxmcreate