p4lang / ptf

Packet Test Framework
Apache License 2.0
146 stars 99 forks source link

[ptf]: EventDescriptor destructor fails with exception #108

Closed nazariig closed 1 year ago

nazariig commented 4 years ago

Summary EventDescriptor class has a bug in destructor implementation. It tries to access nonexistent system library and fails with the exception:

Exception AttributeError: "'NoneType' object has no attribute 'close'" in <bound method EventDescriptor.__del__ of <ptf.ptfutils.EventDescriptor instance at 0x7f18966645a8>> ignored

line: https://github.com/p4lang/ptf/blob/master/src/ptf/ptfutils.py#L52

Steps to reproduce

Observed behavior EventDescriptor destructor throws an exception

Expected behavior EventDescriptor destructor should do a clean up gracefully

coididy commented 3 years ago

How to solve this problem? thank you!