[
https://issues.apache.org/jira/browse/PROTON-1025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17156290#comment-17156290
]
Jiri Daněk commented on PROTON-1025:
------------------------------------
"BlockingConnection should close itself on unreference" may be a good idea. The
`open()` call in Python behaves this way. If I reassign a new instance of a
file descriptor to a variable, the previous one is closed. If I run Python with
{{-X dev}}, I get a warning then, such as
{noformat}
openfiles.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper
name='/etc/passwd' mode='r' encoding='UTF-8'>
fp = open('/etc/passwd')
ResourceWarning: Enable tracemalloc to get the object allocation traceback
{noformat}
The primary focus of such feature should IMO be to generate the warning.
Closing the socket in {{__del__}} is nice to do, but it is not something the
programmer should learn to rely on.
> CLOSE_WAIT leak following reproducer for PROTON-1023 / PROTON-1024
> ------------------------------------------------------------------
>
> Key: PROTON-1025
> URL: https://issues.apache.org/jira/browse/PROTON-1025
> Project: Qpid Proton
> Issue Type: Bug
> Components: python-binding
> Affects Versions: proton-0.10
> Reporter: Pavel Moravec
> Priority: Minor
>
> Following reproducer for PROTON-1023 or PROTON-1024 (attached at the botton),
> client leaves some sockets in CLOSE_WAIT state forever.
> I tested the reproducer before & after those two fixes and it is present in
> both. I.e. this bug is not a regression caused by PROTON-1023 or PROTON-1024.
> Reproducer:
> (assuming localhost runs qdrouterd that is restarted every 5 seconds in a
> loop):
> {code}
> #!/usr/bin/python
> from time import sleep
> from uuid import uuid4
> from proton import ConnectionException
> from proton.utils import BlockingConnection
> import traceback
> import random
> while True:
> sleep(random.uniform(0.3,3))
> try:
> conn = BlockingConnection("proton+amqp://localhost:5672",
> ssl_domain=None, heartbeat=2)
> rec = conn.create_receiver("another_address", name=str(uuid4()),
> dynamic=False, options=None)
> print "sleeping.."
> sleep(random.uniform(0.3,3))
> rec2 = conn.create_receiver("some_address", name=str(uuid4()),
> dynamic=False, options=None)
> except ConnectionException:
> try:
> if conn:
> conn.close()
> except Exception, e:
> print e
> print(traceback.format_exc())
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]