ejabberd - Comments for "MySQL Connection Pool Exhaustion" https://www.ejabberd.im/node/2726 en Investigate the problem trying different ODBC pool sizes https://www.ejabberd.im/node/2726#comment-51786 <p>I can't help you in this problem, but maybe this gives you ideas to investigate the problem.</p> <p>In ejabberd 1.1.4 and older, the number of SQL connections per host (which is 10 by default) is in the file ejabberd/src/odbc/ejabberd_odbc_sup.erl:</p> <pre>init([Host]) -&gt; % TODO N = 10,</pre><p> In ejabberd 2.0.0-rc1, this can be configured in ejabberd.cfg, so no need to recompile:</p> <div class="quote-msg"> <div class="quote-author">Quote:</div> <p>By default ejabberd opens 10 connections to the database for each virtual host. Use this option to modify the value:</p> <p>{odbc_pool_size, 10}.</p> <p>You can configure an interval to make a dummy SQL request to keep alive the connections to the database. The default value is ’undefined’, so no keepalive requests are made. Specify in seconds: for example 28800 means 8 hours.</p> <p>{odbc_keepalive_interval, undefined}.</p></div> Tue, 12 Feb 2008 09:54:39 +0000 mfoss comment 51786 at https://www.ejabberd.im Updated - file system limits https://www.ejabberd.im/node/2726#comment-51450 <p>It turns out that the ulimit on the server may have been causing the problems though I luckily happen to catch it as it happened. Increasing the ulimit allowed all the MySQL processes to go through (540 total) but now there's a new problem:</p> <pre> (<noindex><a href="mailto:ejabberd@van-ejabberd1.globalrelay.net" rel="nofollow" >ejabberd@van-ejabberd1.globalrelay.net</a></noindex>)1&gt; [05:01 PM] van-ejabberd1:/opt/etc/ejabberd$ tail /tmp/start start, [5223, ejabberd_c2s, [{access,c2s}, tls, {certfile,"/opt/etc/ejabberd/server.pem"}]]}}, {restart_type,transient}, {shutdown,brutal_kill}, {child_type,worker}] (<noindex><a href="mailto:ejabberd@van-ejabberd1.globalrelay.net" rel="nofollow" >ejabberd@van-ejabberd1.globalrelay.net</a></noindex>)1&gt; [05:01 PM] van-ejabberd1:/opt/etc/ejabberd$ tail -100 /tmp/start registered_name: [] error_info: {{badmatch, {error, {{badmatch, {error, "SSL_CTX_use_certificate_file failed: error:02001018:system library:fopen:Too many open files"}}, [{ejabberd_c2s,init,1}, {gen_fsm,init_it,6}, {proc_lib,init_p,5}]}}}, [{ejabberd_listener,accept,3},{proc_lib,init_p,5}]} initial_call: {ejabberd_listener, init, [5223, ejabberd_c2s, [{access,c2s}, tls, {certfile,"/opt/etc/ejabberd/server.pem"}]]} ancestors: [ejabberd_listeners,ejabberd_sup,&lt;0.38.0&gt;] messages: [] links: [#Port&lt;0.993&gt;,&lt;0.212.0&gt;,#Port&lt;0.287&gt;] dictionary: [] trap_exit: false status: running heap_size: 377 stack_size: 21 reductions: 603 neighbours: (<noindex><a href="mailto:ejabberd@van-ejabberd1.globalrelay.net" rel="nofollow" >ejabberd@van-ejabberd1.globalrelay.net</a></noindex>)1&gt; =CRASH REPORT==== 10-Dec-2007::17:01:38 === crasher: pid: &lt;0.4552.0&gt; registered_name: [] error_info: {{badmatch,{error,"SSL_CTX_use_certificate_file failed: error:02001018:system library:fopen:Too many open files"}}, [{ejabberd_c2s,init,1}, {gen_fsm,init_it,6}, {proc_lib,init_p,5}]} initial_call: {gen,init_it, [gen_fsm, &lt;0.214.0&gt;, self, ejabberd_c2s, [{gen_tcp,#Port&lt;0.993&gt;}, [{access,c2s}, tls, {certfile,"/opt/etc/ejabberd/server.pem"}]], []]} ancestors: [&lt;0.214.0&gt;,ejabberd_listeners,ejabberd_sup,&lt;0.38.0&gt;] messages: [] links: [#Port&lt;0.997&gt;] dictionary: [] trap_exit: false status: running heap_size: 987 stack_size: 21 reductions: 2082 neighbours: (<noindex><a href="mailto:ejabberd@van-ejabberd1.globalrelay.net" rel="nofollow" >ejabberd@van-ejabberd1.globalrelay.net</a></noindex>)1&gt; =SUPERVISOR REPORT==== 10-Dec-2007::17:01:38 === Supervisor: {local,ejabberd_listeners} Context: child_terminated Reason: {{badmatch, {error, {{badmatch, {error, "SSL_CTX_use_certificate_file failed: error:02001018:system library:fopen:Too many open files"}}, [{ejabberd_c2s,init,1}, {gen_fsm,init_it,6}, {proc_lib,init_p,5}]}}}, [{ejabberd_listener,accept,3},{proc_lib,init_p,5}]} Offender: [{pid,&lt;0.214.0&gt;}, {name,5223}, {mfa, {ejabberd_listener, start, [5223, ejabberd_c2s, [{access,c2s}, tls, {certfile,"/opt/etc/ejabberd/server.pem"}]]}}, {restart_type,transient}, {shutdown,brutal_kill}, {child_type,worker}] (<noindex><a href="mailto:ejabberd@van-ejabberd1.globalrelay.net" rel="nofollow" >ejabberd@van-ejabberd1.globalrelay.net</a></noindex>)1&gt; =PROGRESS REPORT==== 10-Dec-2007::17:01:38 === supervisor: {local,ejabberd_listeners} started: [{pid,&lt;0.4553.0&gt;}, {name,5223}, {mfa, {ejabberd_listener, start, [5223, ejabberd_c2s, [{access,c2s}, tls, {certfile,"/opt/etc/ejabberd/server.pem"}]]}}, {restart_type,transient}, {shutdown,brutal_kill}, {child_type,worker}] </pre><p> I've googled this error and variants and see some similar situations but nothing resolved (at least least in situations where ulimit has already been increased significantly.</p> <pre>$ ulimit -a core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited open files (-n) 65535 pipe size (512 bytes, -p) 10 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 29995 virtual memory (kbytes, -v) unlimited lsof for ejabberd's user shows 1790+ though this is still well below what the system is set to allow.</pre> Mon, 10 Dec 2007 17:05:54 +0000 tlaramie comment 51450 at https://www.ejabberd.im