Closed blurHY closed 2 years ago
@shortcutme
How many connections do you see on the /Stats page?
Btw, the 1024 max sockets is a libev restriction on Windows.
I've switched to ubuntu recently.So i don't know will this bug occurs again or not
Here on this page of Gevent docs:
Note: On Windows using the libev backend, gevent is limited to a maximum of 1024 open sockets due to limitations in libev. This limitation should not exist with the default libuv backend.
That leads me to believe it's Windows-only.
So we should not run a zeronet spider on Windows.
Bad idea.
Probably it's fixed by moving to Python3 (tested on windows 10):
> py -3 test_limit.py
Max stdio: 512
Testing files...
Error: [Errno 24] Too many open files: 'test_limit.py'
Max: 8189
Testing sockets...
Error: [Errno 10055] [WinError 10055] An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.
Max: 16363
Python2 results:
> py -2 test_limit.py
Max stdio: 512
Testing files...
Error: [Errno 24] Too many open files: 'test_limit.py'
Max: 509
Testing sockets..
Error: cannot watch more than 1024 sockets
Max: 1021
So based on this testing Python2 process was limited to open 509 files and serve 1021 sockets at the same time, Python3 process can open 8189 files and serve 16363 sockets.
The script I used to test: https://gist.github.com/HelloZeroNet/d1f2d5424f4026def8558cc11ed2fa68
Soon after following error ZeroNet crashed. No error crash message, no error.log.
ERROR - Unhandled exception: OSError: cannot watch more than 1024 sockets in lib/gevent/baseserver.py line 199 > ... > corecext.pyx line 640 > 1006
I can confirm that it drops this error when using gevent.config.loop = "libev-cext"
It was changed from libuv to libev, because it had multiple issues with multi-threading + gevent libuv. https://github.com/HelloZeroNet/ZeroNet/commit/51f49cd45aa0677427683828a15d23316c91a9bd I will check if we can switch back to default libev with latest gevent.
I see this error repeatedly when i try to start ZN. ZN run for a few minutes and then there is generic Windows 10 message with only option to terminate app.
[2020-10-13 00:39:47,388] INFO - Libsecpk256k1 loaded: FFILibrary_U:\ZeroNet-win-dist-win64\lib\coincurve\libsecp256k1.dll in 0.246s
[2020-10-13 00:39:49,886] INFO - Version: 0.7.2 r4538, Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)], Gevent: 1.4.0
...
[2020-10-13 00:49:43,359] INFO Site:1abc.def [OK] someIPv4:0: Thanks, file data/users/siteaddresshere/content.json updated! 1/1
[2020-10-13 00:50:28,319] ERROR - Unhandled exception: OSError: cannot watch more than 1024 sockets in lib/gevent/baseserver.py line 199 > ... > corecext.pyx line 640 > 1006
[2020-10-13 00:50:28,690] ERROR - Unhandled exception: OSError: cannot watch more than 1024 sockets in lib/gevent/baseserver.py line 199 > ... > corecext.pyx line 640 > 1006
that errors are only ones in file and last ones at the end of file. see no error log file of ZN.
In previous startup attempt i also see error #2537 but maybe not related. ZN was starting OK, but when i clicked to update on updater zite, then ZN shown after some minutes the terminate windows prompt and now it show it always after start.
rev 3611 win10
Restarting zeronet doesn't help me.