[New-bugs-announce] [issue29564] ResourceWarning tracking is attaching incorrect file:position to unclosed socket

David Ford (FirefighterBlu3) report at bugs.python.org
Tue Feb 14 22:11:36 EST 2017


New submission from David Ford (FirefighterBlu3):

the following warning is incorrectly reported as initiated at psycopg2/extras.py:314, it actually occurs inside the Twilio python module.

/usr/lib/python3.6/site-packages/psycopg2/extras.py:314: ResourceWarning: unclosed <ssl.SSLSocket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('173.12.76.132', 39350), raddr=('52.72.8.76', 443)>
  ts = super(NamedTupleCursor, self).fetchall()
namedtuple_Record:19: ResourceWarning: unclosed <ssl.SSLSocket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('173.12.76.132', 57692), raddr=('107.23.182.60', 443)>



This is the snippet of my code which makes the Twilio API call over https (noted by the >>> line).

            # get failed/undelivered
            with (yield from self.aiopg_pool.cursor(cursor_factory=psycopg2.extras.NamedTupleCursor)) as c:
                yield from c.execute(stmt_bad, (id,))
                rows = yield from c.fetchall()

            # make calls to twilio and fetch failure reasons
            for r in rows:
>>>             msg = self._twilio.messages.get(r.delivery_id)
                errors[r.delivery_id] = r.recipient, msg.error_code, msg.error_message


my tool uses crossbar.io's python-autobahn asyncio classes which do not use threading to my knowledge. psycopg2/pool.py does use threading. python-twilio does not use threading either.

----------
messages: 287810
nosy: David Ford (FirefighterBlu3)
priority: normal
severity: normal
status: open
title: ResourceWarning tracking is attaching incorrect file:position to unclosed socket
type: resource usage
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29564>
_______________________________________


More information about the New-bugs-announce mailing list