New submission from Bale <hswhsw...@gmail.com>:

In the file I attached below is a pretty simple asyncio server, it is identical 
to the echo server on the documentation except it does not disconnect after 
echoing. 

When a connection is received, it creates an object called "test object" and 
the only reference to that object is on the local scope. If all is working 
properly, when the handler function returns the test object should also be 
deleted, but I noticed the __del__ method is not being called, indicating 
python is not deleting it. It seems like a reference to the frame of the 
handler is being kept in a list (not sure where) and it is not being removed 
from it.

Here is example code of how to trigger the bug:
s = socket.socket();s.connect(("127.0.0.1", 8888));s.send(b"test\0")
s.close()

By sending data and closing afterwards WITHOUT using s.recv() causes the issue, 
what's interesting is that if we call s.close() immediately after sending, the 
object is deleted by the server and everything works as intended. Calling 
s.close() a few seconds after, causes the bug to happen. It should also be 
noted that if I call s.recv() before s.close(), the bug does not happen.

What's more interesting is that when I run the above code in my python3.5 
interpreter the bug does not get triggered, no matter what I do. The bug does 
also not happen when I run it in a python3.8 interpreter on my windows 
computer. When I run on the code on ubuntu on a python3.8 interpreter, the bug 
is triggered.

----------
Added file: https://bugs.python.org/file49460/test_server.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41794>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to