Zeronet: IOError: cannot watch more than 1024 sockets

Created on 8 Oct 2017  路  21Comments  路  Source: HelloZeroNet/ZeroNet

[14:07:23] - Unhandled exception
Traceback (most recent call last):
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\baseserver.py", line 186, in _do_read
    args = self.do_read()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\server.py", line 111, in do_read
    client_socket, address = self.socket.accept()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 195, in accept
    sockobj = socket(_sock=client_socket)
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 122, in __init__
    self._read_event = io(fileno, 1)
  File "gevent\corecext.pyx", line 480, in gevent.corecext.loop.io (gevent/gevent.corecext.c:8804)
  File "gevent\corecext.pyx", line 825, in gevent.corecext.io.__init__ (gevent/gevent.corecext.c:15470)
IOError: cannot watch more than 1024 sockets
Traceback (most recent call last):
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\baseserver.py", line 186, in _do_read
    args = self.do_read()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\server.py", line 111, in do_read
    client_socket, address = self.socket.accept()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 195, in accept
    sockobj = socket(_sock=client_socket)
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 122, in __init__
    self._read_event = io(fileno, 1)
  File "gevent\corecext.pyx", line 480, in gevent.corecext.loop.io (gevent/gevent.corecext.c:8804)
  File "gevent\corecext.pyx", line 825, in gevent.corecext.io.__init__ (gevent/gevent.corecext.c:15470)
IOError: cannot watch more than 1024 sockets
[14:07:23] - Unhandled exception
Traceback (most recent call last):
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\baseserver.py", line 186, in _do_read
    args = self.do_read()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\server.py", line 111, in do_read
    client_socket, address = self.socket.accept()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 195, in accept
    sockobj = socket(_sock=client_socket)
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 122, in __init__
    self._read_event = io(fileno, 1)
  File "gevent\corecext.pyx", line 480, in gevent.corecext.loop.io (gevent/gevent.corecext.c:8804)
  File "gevent\corecext.pyx", line 825, in gevent.corecext.io.__init__ (gevent/gevent.corecext.c:15470)
IOError: cannot watch more than 1024 sockets
Traceback (most recent call last):
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\baseserver.py", line 186, in _do_read
    args = self.do_read()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\server.py", line 111, in do_read
    client_socket, address = self.socket.accept()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 195, in accept
    sockobj = socket(_sock=client_socket)
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 122, in __init__
    self._read_event = io(fileno, 1)
  File "gevent\corecext.pyx", line 480, in gevent.corecext.loop.io (gevent/gevent.corecext.c:8804)
  File "gevent\corecext.pyx", line 825, in gevent.corecext.io.__init__ (gevent/gevent.corecext.c:15470)
IOError: cannot watch more than 1024 sockets
[14:07:24] - Unhandled exception
Traceback (most recent call last):
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\baseserver.py", line 186, in _do_read
    args = self.do_read()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\server.py", line 111, in do_read
    client_socket, address = self.socket.accept()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 195, in accept
    sockobj = socket(_sock=client_socket)
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 122, in __init__
    self._read_event = io(fileno, 1)
  File "gevent\corecext.pyx", line 480, in gevent.corecext.loop.io (gevent/gevent.corecext.c:8804)
  File "gevent\corecext.pyx", line 825, in gevent.corecext.io.__init__ (gevent/gevent.corecext.c:15470)
IOError: cannot watch more than 1024 sockets
Traceback (most recent call last):
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\baseserver.py", line 186, in _do_read
    args = self.do_read()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\server.py", line 111, in do_read
    client_socket, address = self.socket.accept()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 195, in accept
    sockobj = socket(_sock=client_socket)
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 122, in __init__
    self._read_event = io(fileno, 1)
  File "gevent\corecext.pyx", line 480, in gevent.corecext.loop.io (gevent/gevent.corecext.c:8804)
  File "gevent\corecext.pyx", line 825, in gevent.corecext.io.__init__ (gevent/gevent.corecext.c:15470)
IOError: cannot watch more than 1024 sockets
[14:07:29] - Unhandled exception
Traceback (most recent call last):
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\baseserver.py", line 186, in _do_read
    args = self.do_read()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\server.py", line 111, in do_read
    client_socket, address = self.socket.accept()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 195, in accept
    sockobj = socket(_sock=client_socket)
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 122, in __init__
    self._read_event = io(fileno, 1)
  File "gevent\corecext.pyx", line 480, in gevent.corecext.loop.io (gevent/gevent.corecext.c:8804)
  File "gevent\corecext.pyx", line 825, in gevent.corecext.io.__init__ (gevent/gevent.corecext.c:15470)
IOError: cannot watch more than 1024 sockets
Traceback (most recent call last):
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\baseserver.py", line 186, in _do_read
    args = self.do_read()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\server.py", line 111, in do_read
    client_socket, address = self.socket.accept()
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 195, in accept
    sockobj = socket(_sock=client_socket)
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 122, in __init__
    self._read_event = io(fileno, 1)
  File "gevent\corecext.pyx", line 480, in gevent.corecext.loop.io (gevent/gevent.corecext.c:8804)
  File "gevent\corecext.pyx", line 825, in gevent.corecext.io.__init__ (gevent/gevent.corecext.c:15470)
IOError: cannot watch more than 1024 sockets
[14:07:32] - Unhandled exception
Traceback (most recent call last):
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "plugins\AnnounceZero\AnnounceZeroPlugin.py", line 49, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "D:\ZeroBundle\ZeroNet\src\Site\Site.py", line 823, in announceTracker
    tracker = UdpTrackerClient(ip, int(port))
  File "D:\ZeroBundle\ZeroNet\src\lib\subtl\subtl.py", line 43, in __init__
    self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 122, in __init__
    self._read_event = io(fileno, 1)
  File "gevent\corecext.pyx", line 480, in gevent.corecext.loop.io (gevent/gevent.corecext.c:8804)
  File "gevent\corecext.pyx", line 825, in gevent.corecext.io.__init__ (gevent/gevent.corecext.c:15470)
IOError: cannot watch more than 1024 sockets
Traceback (most recent call last):
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "plugins\AnnounceZero\AnnounceZeroPlugin.py", line 49, in announceTracker
    tracker_protocol, tracker_address, fileserver_port, add_types, my_peer_id, mode
  File "D:\ZeroBundle\ZeroNet\src\Site\Site.py", line 823, in announceTracker
    tracker = UdpTrackerClient(ip, int(port))
  File "D:\ZeroBundle\ZeroNet\src\lib\subtl\subtl.py", line 43, in __init__
    self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  File "D:\ZeroBundle\Python\lib\site-packages\gevent\_socket2.py", line 122, in __init__
    self._read_event = io(fileno, 1)
  File "gevent\corecext.pyx", line 480, in gevent.corecext.loop.io (gevent/gevent.corecext.c:8804)
  File "gevent\corecext.pyx", line 825, in gevent.corecext.io.__init__ (gevent/gevent.corecext.c:15470)
IOError: cannot watch more than 1024 sockets

I can't visit http://127.0.0.1:43110/1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D to surf zeronet, what should I do?

bug

Most helpful comment

I am happy to report i have seen no connections issue since your fix on my Windows.

All 21 comments

I'm also experiencing this error.
It just happens, after some time, restarting the client helps, though, only for limited time until you have to repeat the process.

Yes, restart ZeroNet helps, but after some time again..

How many http://127.0.0.1:43110/Stats shows to you? (eg.: Connections (69, total made: 360))

@HelloZeroNet ScreenShot:
image

Hmm that's weird
How much site you have in your client?
How much time does it takes until it gets filled?
Have you modified any settings of your client?

I'm sorry, I'm afraid that is one of many hard coded limitations of gevent and libev on windows.

Catch again.

196 site, haven't modified setting.

debug.log.zip:
debug.log.zip

I have this issue too, latest Zeronet is hardly usable, Win. 10 64b.
In my case i got this: Connections (997, total made: 10819)
If i am not wrong i am connected to zites: 561

afraid that is one of many hard coded limitations of gevent and libev on windows

it seems like that, on Linux this is not issue?

Is it possible make Zeronet limit the connections ZeroHello (i assume it is main connections hog in this case) is producing so it do not affect regular browsing behavior? I mean ZeroHello on WIndows should leave reasonable amount of sockets available out of 1024 limit so it do not affect regular browsing (example 5 zites loading at a time)? https://www.reddit.com/r/learnpython/comments/3ml5zo/grequestsgevent_io_limit_help/

I am not a programmer, so i am asking You programmers. Thank you

I have added a modification in Rev3229 that should keep the connections under 512 (by default) and it should stop keeping open connections for sites that not modified in the last 7 days.
Please update and see if it's working better.

@HelloZeroNet my status after ~7 hours of running zeronet:
Connections (517, total made: 8072)
The number of active connections stays roughly same for previous hours.
I am "connected to" (visited and not deleted) roughly 600 zites.
it seems like You solved it, because for last around 7 hours i seen no "Connection with UiServer Websocket was lost" and have no issue browsing zeronet which is great. Thank you

Just now i found zites are not loading in TorBrowser, it resulted in default browser error: The connection was reset.
At http://127.0.0.1:43110/Stats i seen: Connections (1034, total made: 34205)
If i can supply any other specific details, let me know which/where. I do not want to provide full log, only in private. Thank you

Can you please send the log to [email protected] ?

@slrslr Thanks for the log I was able to spot and fix the problem in Rev3233 that broke the cleanup method.

Please update and see if it's works now.

@HelloZeroNet Thanks, issue reappeared probably, so i sent you my log via yours mentioned e-mail.

Thanks, I have added a new update to fix connection error with unknown characters: https://github.com/HelloZeroNet/ZeroNet/commit/6fb9c6ef05aa7578bd0529c4022657612bcaf9c8
Please update to Rev3234 and let me know if the problem still exists.

I am happy to report i have seen no connections issue since your fix on my Windows.

Nice to hear, and how many active connections do you have after this fix?

I think that yesterday i was seeing 150 when i was idle, then after more active surfing i think i seen something like 250.

Maybe this should be reopen

@HelloZeroNet @shortcutme

1663

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blurHY picture blurHY  路  3Comments

imachug picture imachug  路  3Comments

DaniellMesquita picture DaniellMesquita  路  3Comments

DaniellMesquita picture DaniellMesquita  路  3Comments

iShift picture iShift  路  3Comments