Hi, and thanks for a great library. Got it up and running in just a few minutes!
But after some time I got a problem. After sending 1024 it cannot accept new connections, apparently the sockets don't close properly after the requests has been dispatched? I can consistently trigger the bug by hammering the server 1024 times, which is the limit to how many files I can open on my debian-based systems (Tried it on both arm and x86 platforms).
I start the server in detached mode:
o=onion_new(O_THREADED|O_DETACH_LISTEN);
onion_set_timeout(o,5000);
onion_set_hostname(o,Host.c_str());
onion_set_port(o,Port.c_str());
handler=onion_handler_new(root_handler,this,NULL);
onion_set_root_handler(o,handler);
onion_listen(o);
And handle the requests in root_handler() which returns OCS_PROCESSED.
The stdout looks like this when the problem occurs:
[7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files
[7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection
Hi, and thanks for a great library. Got it up and running in just a few minutes!
But after some time I got a problem. After sending 1024 it cannot accept new connections, apparently the sockets don't close properly after the requests has been dispatched? I can consistently trigger the bug by hammering the server 1024 times, which is the limit to how many files I can open on my debian-based systems (Tried it on both arm and x86 platforms).
I start the server in detached mode: o=onion_new(O_THREADED|O_DETACH_LISTEN); onion_set_timeout(o,5000); onion_set_hostname(o,Host.c_str()); onion_set_port(o,Port.c_str()); handler=onion_handler_new(root_handler,this,NULL); onion_set_root_handler(o,handler); onion_listen(o);
And handle the requests in root_handler() which returns OCS_PROCESSED.
The stdout looks like this when the problem occurs: [7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7F34B700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:299] Error accepting connection: Too many open files [7D347700] [2022-10-15 11:37:44] [ERROR listen_point.c:124] Error creating connection