Hi,
When running a python script connecting to a few hundred devices sequentially, I sometimes run into:
OSError: out of pty devices.
Traceback is:
Traceback (most recent call last):
File "src/unicon/bases/connection.py", line 604, in unicon.bases.connection.Connection.connect
File "src/unicon/bases/linux/connection.py", line 89, in unicon.bases.linux.connection.BaseLinuxConnection.setup_connection
File "src/unicon/eal/expect.py", line 23, in unicon.eal.expect.Spawn.__new__
File "src/unicon/eal/backend/pty_backend.py", line 487, in unicon.eal.backend.pty_backend.Spawn.__init__
File "src/unicon/eal/backend/pty_backend.py", line 377, in unicon.eal.backend.pty_backend.RawPtySpawn.__init__
File "/usr/lib/python3.8/pty.py", line 96, in fork
File "/usr/lib/python3.8/pty.py", line 29, in openpty
File "/usr/lib/python3.8/pty.py", line 59, in _open_terminal
OSError: out of pty devices
My script gets a list of devices, creates a testbed entry for the device accessed by 2 proxies (same for all) and then does
create Device object
add device to testbed
connect to device
show inventory
show version
show cdp neighbors
disconnect from device
The devices are a variety of Cisco routers and switches: ios, iosxe, nxos.
Is there some reason the ptys are getting consumed?
I expected the disconnect to release resources per device.
Thanks