Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Getting FileNotFoundError exception if multiple instances of SnmpSession were previously used #1

Closed
arthur-zzz opened this issue Feb 13, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@arthur-zzz
Copy link

Describe the issue:

Getting a FileNotFoundError exception if multiple instances of SnmpSession were previously used.

Reproduce the code example:

import asyncio
from gufo.snmp import SnmpSession

async def run_multiple_sessions() -> None:
    for i in range(10):
        async with SnmpSession(
            addr="127.0.0.1",
            community="public"
        ) as session:
            async for _ in session.fetch("1.3.6.1.2.1.1"):
                pass

asyncio.run(run_multiple_sessions())

Error message:

Traceback (most recent call last):
  File "/opt/gufo-snmp/run-multiple.py", line 13, in <module>
    asyncio.run(run_multiple_sessions())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/opt/gufo-snmp/run-multiple.py", line 10, in run_multiple_sessions
    async for _ in session.fetch("1.3.6.1.2.1.1"):
  File "/opt/gufo-snmp/venv/lib/python3.9/site-packages/gufo/snmp/getbulk.py", line 74, in __anext__
    loop.add_writer(self._fd, w_ev.set)
  File "/usr/lib/python3.9/asyncio/selector_events.py", line 346, in add_writer
    self._add_writer(fd, callback, *args)
  File "/usr/lib/python3.9/asyncio/selector_events.py", line 304, in _add_writer
    self._selector.modify(fd, mask | selectors.EVENT_WRITE,
  File "/usr/lib/python3.9/selectors.py", line 390, in modify
    self._selector.modify(key.fd, selector_events)
FileNotFoundError: [Errno 2] No such file or directory

Python version information

3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110

Gufo Ping version information

0.1.0

Operation system version

Debian GNU/Linux 11 (bullseye)

@arthur-zzz arthur-zzz added the bug Something isn't working label Feb 13, 2023
@dvolodin7 dvolodin7 self-assigned this Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants