You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a long-running process (e.g. a Celery worker) the following error occurs occasionally indicating that there are too many file descriptors for select().
ValueError: filedescriptor out of range in select()
File "download.py", line 292, in _smb_connect
smb.connect(ip_address)
File "smb/SMBConnection.py", line 122, in connect
self._pollForNetBIOSPacket(timeout)
File "smb/SMBConnection.py", line 590, in _pollForNetBIOSPacket
ready, _, _ = select.select([ self.sock.fileno() ], [ ], [ ], timeout)
select() has a limitation on the number of file descriptors it can watch. Often this is 1024, at least on Unix systems.
Below is a patched SMBConnection class that uses poll() instead of select() to work around this limitation. However, poll() is only supported on Unix systems, which is why a potential PR to fix this would have to implement both methods depending on the OS.
@itssimon : Thanks for your code. I believe your situation is unique as most applications won't have 1000+ open file descriptors floating around.
I would flag your issue as an improvement. Someone else might find your code useful if they encounter the same issue.
I am running into this as well, unfortunately this specific ticket didn't come up in my Google searches but I did find prompt-toolkit/python-prompt-toolkit#354 and someone posted a fairly similar fix for this.
In a long-running process (e.g. a Celery worker) the following error occurs occasionally indicating that there are too many file descriptors for
select()
.select()
has a limitation on the number of file descriptors it can watch. Often this is 1024, at least on Unix systems.Below is a patched
SMBConnection
class that usespoll()
instead ofselect()
to work around this limitation. However,poll()
is only supported on Unix systems, which is why a potential PR to fix this would have to implement both methods depending on the OS.Just wanted to document this issue and workaround here to start with. If anyone wants to work on a PR that uses the above code, feel free to do so.
The text was updated successfully, but these errors were encountered: