Menu

#78 File descriptor leak causes unhelpful exception

None
closed-fixed
None
5
2015-03-07
2015-03-06
Robie Basak
No

Actual behaviour:

When the number of permitted file descriptors is exceeded, I see a traceback of the form:

Exception in callback <bound method="" AsyncioDispatcher._cbFun="" of="" <pysnmp.carrier.asyncio.dispatch.AsyncioDispatcher="" object="" at="" 0x7fdd406e5ef0="">>(<pysnmp.carrier.asyncio.dgram.udp6.Udp6AsyncioTransport object="" at="" 0x7fdd406e52e8="">, ('<REMOVED>', 161, 0, 0), b'<REMOVED>')
handle: Handle(<bound method="" AsyncioDispatcher._cbFun="" of="" <pysnmp.carrier.asyncio.dispatch.AsyncioDispatcher="" object="" at="" 0x7fdd406e5ef0="">>, (<pysnmp.carrier.asyncio.dgram.udp6.Udp6AsyncioTransport object="" at="" 0x7fdd406e52e8="">, ('<REMOVED>', 161, 0, 0), b'0<REMOVED>'))
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/events.py", line 39, in _run
self._callback(*self._args)
File "/home/robie/Code/snmp/pysnmp/carrier/base.py", line 52, in _cbFun
File "/home/robie/Code/snmp/pysnmp/entity/engine.py", line 110, in receiveMessageCbFun
File "/home/robie/Code/snmp/pysnmp/proto/rfc3412.py", line 312, in receiveMessage
File "/home/robie/Code/snmp/pysnmp/smi/builder.py", line 302, in importSymbols
File "/home/robie/Code/snmp/pysnmp/smi/builder.py", line 273, in loadModules
pysnmp.smi.error.SmiError: MIB file "
SNMPv2-MIB.py[co]" not found in search path

It looks like this is because __SNMPv2-MIB.py could not be found, when in fact it is there but just could not be opened. It looks like this happens because the DirMibSource class blindly ignores OSError exceptions.

Expected behaviour: the OSError exception caused by EMFILE should be passed through. I don't know for which errno values the exception is being ignored here, but the expected exception should be checked for specific errno values and all others re-raised.

Discussion

  • Ilya Etingof

    Ilya Etingof - 2015-03-07

    Fixed in CVS. Please report back on any issues.

     
  • Ilya Etingof

    Ilya Etingof - 2015-03-07
    • status: open --> closed-fixed
    • assigned_to: Ilya Etingof
    • Group: -->
     

Log in to post a comment.