ejabberd - Comments for "Can&amp;#039;t Access Virtual Hosts Page" https://www.ejabberd.im/node/482 en LDAP w/ lots of users, solution https://www.ejabberd.im/node/482#comment-1087 <p>Hi,</p> <p>This problem has been resolved:</p> <p><noindex><a href="http://www.jabber.ru/bugzilla/show_bug.cgi?id=179" title="http://www.jabber.ru/bugzilla/show_bug.cgi?id=179" rel="nofollow" >http://www.jabber.ru/bugzilla/show_bug.cgi?id=179</a></noindex></p> <p>I'm not sure if this will be merged with the CVS branch or what, but its just a one line fix, well, and changing CMD_TIMEOUT to something larger than 5 seconds.</p> <p>Thanks for everyones help!</p> <p>--Marc</p> Tue, 22 Nov 2005 19:58:42 +0000 msmith comment 1087 at https://www.ejabberd.im erlang CMD_TIMEOUT limit? https://www.ejabberd.im/node/482#comment-1054 <p>This couldn't be caused by another variable set in somewhere is the erlang install, could it?</p> <p>I can adjust CMD_TIMEOUT to something lower (4000, 3000, etc.) and the time will decrease according to what its set at. I can't get the time to last any longer than 5 seconds and some change. I've tried setting CMD_TIMEOUT to 5050 and all the way up to 100000. It never goes past ~6 seconds!</p> <pre>esdev2# time su ejabberd -c "/usr/local/bin/ejabberdctl ejabberd@`hostname -s` registered-users" Can't get list of registered users at node ejabberd@esdev2: {'EXIT', {timeout, {gen_fsm, sync_send_event, ['eldap_ejabberd_esdev2.mcc.edu', {search, {eldap_search, wholeSubtree, "ou=Users,dc=mcc,dc=edu", {present, "uid"}, ["uid"], false, 0}}]}}} 0.025u 0.520s 0:05.79 9.3% 580+5337k 0+0io 0pf+0w esdev2# </pre><p> This test server is a VMware virtual machine -- it couldn't be anything weird with time (the VMs are always a bit funk with the time stuff)?</p> <p>Does anyone else use ejabberd &amp; LDAP with lots (+13,000) users?</p> <p>Thanks,</p> <p>Marc</p> Thu, 17 Nov 2005 18:48:07 +0000 msmith comment 1054 at https://www.ejabberd.im Won't Patch Correctly https://www.ejabberd.im/node/482#comment-1044 <p>Hi,</p> <p>Thanks for the reply, but I can't get eldap.erl to patch correctly:</p> <p>esdev2# patch &lt; /root/ejabberd/eldap.erl.patch<br /> Hmm... Looks like a unified diff to me...<br /> The text leading up to this was:<br /> --------------------------<br /> |--- eldap.erl (revisión: 433)<br /> |+++ eldap.erl (copia de trabajo)<br /> --------------------------<br /> Patching file eldap.erl using Plan A...<br /> Hunk #1 failed at 559.<br /> Hunk #2 succeeded at 732 (offset -1 lines).<br /> Hunk #3 succeeded at 765 (offset -1 lines).<br /> 1 out of 3 hunks failed--saving rejects to eldap.erl.rej<br /> done</p> <p>esdev2# cat eldap.erl.rej<br /> ***************<br /> *** 559,565 ****<br /> log2("~p~n",[{Name, Request}], S),<br /> {ok, Bytes} = asn1rt:encode('ELDAPv3', 'LDAPMessage', Message),<br /> ok = gen_tcp:send(S#eldap.fd, Bytes),<br /> - Timer = erlang:start_timer(?CMD_TIMEOUT, self(), {cmd_timeout, Id}),<br /> New_dict = dict:store(Id, [{Timer, From, Name}], S#eldap.dict),<br /> {ok, S#eldap{id = Id,<br /> dict = New_dict}}.<br /> --- 559,567 ----<br /> log2("~p~n",[{Name, Request}], S),<br /> {ok, Bytes} = asn1rt:encode('ELDAPv3', 'LDAPMessage', Message),<br /> ok = gen_tcp:send(S#eldap.fd, Bytes),<br /> + Timer = erlang:start_timer(43000, self(), {cmd_timeout, Id}),<br /> + io:format(" -- eldap - start_timer - ~p --~ncommand: ~p~nfrom: ~p~ns:~p~ntimer: ~p~n~n",<br /> + [erlang:now(), Command, From, S, Timer]),<br /> New_dict = dict:store(Id, [{Timer, From, Name}], S#eldap.dict),<br /> {ok, S#eldap{id = Id,<br /> dict = New_dict}}.</p> <p>esdev2# cat eldap.erl.patch<br /> --- eldap.erl (revisión: 433)<br /> +++ eldap.erl (copia de trabajo)<br /> @@ -559,7 +559,9 @@<br /> log2("~p~n",[{Name, Request}], S),<br /> {ok, Bytes} = asn1rt:encode('ELDAPv3', 'LDAPMessage', Message),<br /> ok = gen_tcp:send(S#eldap.fd, Bytes),<br /> - Timer = erlang:start_timer(?CMD_TIMEOUT, self(), {cmd_timeout, Id}),<br /> + Timer = erlang:start_timer(43000, self(), {cmd_timeout, Id}),<br /> + io:format(" -- eldap - start_timer - ~p --~ncommand: ~p~nfrom: ~p~ns:~p~ntimer: ~p~n~n",<br /> + [erlang:now(), Command, From, S, Timer]),<br /> New_dict = dict:store(Id, [{Timer, From, Name}], S#eldap.dict),<br /> {ok, S#eldap{id = Id,<br /> dict = New_dict}}.<br /> @@ -732,6 +733,7 @@</p> <p> cancel_timer(Timer) -&gt;<br /> erlang:cancel_timer(Timer),<br /> + io:format(" -- eldap - cancel_timer - ~p --~ntimer: ~p~n~n", [erlang:now(), Timer]),<br /> receive<br /> {timeout, Timer, _} -&gt;<br /> ok<br /> @@ -764,6 +766,8 @@<br /> %% Sort out timed out commands<br /> %%-----------------------------------------------------------------------<br /> cmd_timeout(Timer, Id, S) -&gt;<br /> + io:format(" -- eldap - cmd_timeout - ~p --~ntimer: ~p~nid: ~p~ns:~p~n~n",<br /> + [erlang:now(), Timer, Id, S]),<br /> Dict = S#eldap.dict,<br /> case dict:find(Id, Dict) of<br /> {ok, [{Timer, From, Name}|Res]} -&gt;</p> <p>I thought maybe this was because I wasn't using the CVS version, so I got eldap.erl from CVS, but it failed with the same message.</p> <p>Thanks,</p> <p>Marc</p> Mon, 14 Nov 2005 21:33:36 +0000 msmith comment 1044 at https://www.ejabberd.im some help for debugging https://www.ejabberd.im/node/482#comment-1043 <p>Offtopic: There's a new feature on this forum: now you can see the thread plain instead of nested.</p> <p>In topic: look at ejabberd/src/eldap/eldap.erl line 554:</p> <pre>send_command(Command, From, S) -&gt; ... {ok, Bytes} = asn1rt:encode('ELDAPv3', 'LDAPMessage', Message), ok = gen_tcp:send(S#eldap.fd, Bytes), Timer = erlang:start_timer(?CMD_TIMEOUT, self(), {cmd_timeout, Id}), ...</pre><p> That function seams to be the one that sends the request and starts the timer. Check the <noindex><a href="http://erlang.se/doc/doc-5.4.8/lib/kernel-2.10.9/doc/html/erlang.html" rel="nofollow" >documentation</a></noindex> for start_timer. It only says: 'Time is a non-negative integer... Time ms ... The timeout value must fit in 32 bits.'</p> <p>To help your debugging, you can apply this patch to eldap.erl (note that I've not even tried to compile this):</p> <pre>--- eldap.erl (revisión: 433) +++ eldap.erl (copia de trabajo) @@ -559,7 +559,9 @@ log2("~p~n",[{Name, Request}], S), {ok, Bytes} = asn1rt:encode('ELDAPv3', 'LDAPMessage', Message), ok = gen_tcp:send(S#eldap.fd, Bytes), - Timer = erlang:start_timer(?CMD_TIMEOUT, self(), {cmd_timeout, Id}), + Timer = erlang:start_timer(43000, self(), {cmd_timeout, Id}), + io:format(" -- eldap - start_timer - ~p --~ncommand: ~p~nfrom: ~p~ns:~p~ntimer: ~p~n~n", + [erlang:now(), Command, From, S, Timer]), New_dict = dict:store(Id, [{Timer, From, Name}], S#eldap.dict), {ok, S#eldap{id = Id, dict = New_dict}}. @@ -732,6 +733,7 @@ cancel_timer(Timer) -&gt; erlang:cancel_timer(Timer), + io:format(" -- eldap - cancel_timer - ~p --~ntimer: ~p~n~n", [erlang:now(), Timer]), receive {timeout, Timer, _} -&gt; ok @@ -764,6 +766,8 @@ %% Sort out timed out commands %%----------------------------------------------------------------------- cmd_timeout(Timer, Id, S) -&gt; + io:format(" -- eldap - cmd_timeout - ~p --~ntimer: ~p~nid: ~p~ns:~p~n~n", + [erlang:now(), Timer, Id, S]), Dict = S#eldap.dict, case dict:find(Id, Dict) of {ok, [{Timer, From, Name}|Res]} -&gt;</pre><p>It forces a timeout of 43 seconds for commands, and prints on the log file some messages.</p> <p>Anyway, I'm thinking now that maybe ejabberd should not list all the users on the LDAP server, but only the ones that have sometime logged on ejabberd. This behaviour should be used on Shared Roster Groups too: when you specify @all@, instead of adding all LDAP users to a shared roster group, add only the ones that logged on the Jabber server.</p> Mon, 14 Nov 2005 20:29:34 +0000 mfoss comment 1043 at https://www.ejabberd.im Does TIMEOUT variable have a ceiling? https://www.ejabberd.im/node/482#comment-1042 <p>Hi,</p> <p>I really don't know that much about programming, but I have done some experiments with this problem, and I can't make the timeout any longer than 6 seconds (real time).</p> <p>-define(RETRY_TIMEOUT, 5000).<br /> -define(BIND_TIMEOUT, 10000).<br /> -define(CMD_TIMEOUT, 5000).</p> <p>Those are the default values, but if I set each to say 100,000,000 the timeout is still only 6 seconds. I check this by doing a 'time ejabberdctl ejabberd@host registered-users' and its always 6 no matter how high I make it. Its also only 6 seconds with the default values.</p> <p>Now, if I lower these values, say half the default values, it times out in half the time, 3 seconds. I've been changing all 3, but I'm assuming the only one I really need to be changing for my problem is CMD_TIMEOUT? Or maybe I need to change the others too?</p> <p>So setting the values lower changed the results with my problem. I just can't get the timeout to increase past 6 seconds. So, I guess I'm just wondering if the variable is the wrong type or something similar. It seems as though I've hit some kind of ceiling.</p> <p>Thanks for any help!</p> <p>--Marc</p> Mon, 14 Nov 2005 18:57:04 +0000 msmith comment 1042 at https://www.ejabberd.im Advanced LDAP config in ejabberd.cfg? https://www.ejabberd.im/node/482#comment-1036 <p>Hi,</p> <p>I don't see any errors in my slapd log file when trying to access the virtual hosts page.</p> <p>Nov 11 11:17:45 acad1 slapd[11452]: conn=4 op=34 SRCH base="ou=Users,dc=mcc,dc=edu" scope=2 deref=0 filter="(uid=msmith)"<br /> Nov 11 11:17:45 acad1 slapd[11452]: conn=4 op=34 SEARCH RESULT tag=101 err=0 nentries=1 text=<br /> Nov 11 11:17:45 acad1 slapd[11456]: conn=3 op=27 BIND anonymous mech=implicit ssf=0<br /> Nov 11 11:17:45 acad1 slapd[11456]: conn=3 op=27 BIND dn="uid=msmith,ou=Users,dc=mcc,dc=edu" method=128<br /> Nov 11 11:17:45 acad1 slapd[11456]: conn=3 op=27 BIND dn="uid=msmith,ou=Users,dc=mcc,dc=edu" mech=SIMPLE ssf=0<br /> Nov 11 11:17:45 acad1 slapd[11456]: conn=3 op=27 RESULT tag=97 err=0 text=<br /> Nov 11 11:17:45 acad1 slapd[11452]: conn=4 op=35 SRCH base="ou=Users,dc=mcc,dc=edu" scope=2 deref=0 filter="(uid=*)"<br /> Nov 11 11:17:45 acad1 slapd[11452]: conn=4 op=35 SRCH attr=uid<br /> Nov 11 11:17:51 acad1 slapd[11452]: conn=4 op=35 SEARCH RESULT tag=101 err=0 nentries=14055 text=</p> <p>Other things that use LDAP work fine too... doing a 'getent passwd' with nss_ldap works fine, but I'm sure different applications can work differently and its not always the same. Are there any other settings for ejabberd with LDAP? Like advanced search filters?</p> <p>I already have one setting in my slapd.conf for searches:</p> <p>sizelimit 65435</p> <p>I'll take a look for some other slapd timeout type settings. Should I turn up slapd logging level? Maybe I'm not seeing everything with a '256' loglevel?</p> <p>Thanks for everyones help.</p> <p>--Marc</p> Fri, 11 Nov 2005 18:53:09 +0000 msmith comment 1036 at https://www.ejabberd.im Check your LDAP server logs and settings https://www.ejabberd.im/node/482#comment-1031 <p>Check the logfiles and settings in your LDAP server. LDAP servers can limit the number of items returned in a search (or the amount of time a search is allowed to take).</p> <p>Perhaps the limit you are reaching is configured in your LDAP server instead of your ejabberd.</p> <p>Greg</p> Fri, 11 Nov 2005 06:43:19 +0000 gandrews comment 1031 at https://www.ejabberd.im Works fine with ~100 users https://www.ejabberd.im/node/482#comment-1030 <p>I cloned my LDAP server and added roughly 100 users, and it works fine. So, 13,000 users is just too much for it? Is there anywhere else a 'timeout' variable is set besides what I already tried?</p> <p>Has anyone else been using ejabberd &amp; LDAP with a large number of users (13,000 or more)?</p> <p>Thanks,</p> <p>Marc</p> Thu, 10 Nov 2005 22:04:06 +0000 msmith comment 1030 at https://www.ejabberd.im Doesn't seem to help https://www.ejabberd.im/node/482#comment-1029 <p>I can't get ejabberd to compile with out the FreeBSD ports system, so I just used that:</p> <p># cd /usr/ports/net/ejabberd<br /> # make clean<br /> # make configure<br /> # vi work/ejabberd-0.9.8/src/eldap/eldap.erl</p> <p>I changed the 3 'TIMEOUT' to look like this:</p> <p>-define(RETRY_TIMEOUT, 5000000).<br /> -define(BIND_TIMEOUT, 10000000).<br /> -define(CMD_TIMEOUT, 5000000).</p> <p>Next:</p> <p># make build<br /> # make install</p> <p>I fired up ejabberd and tail'd the sasl.log file -- I get the same problem, but it doesn't seem to take any longer to appear after clicking something that trys to pull a list of users. Which I would think I'd notice a difference when multiplying the values by 1000.</p> <p>I'll try another experiment -- I'll clone my LDAP server and take out all users except for 10 and see how that works.</p> <p>I'll post again soon.</p> <p>Thanks for the help.</p> <p>--Marc</p> Thu, 10 Nov 2005 13:36:18 +0000 msmith comment 1029 at https://www.ejabberd.im Maybe it can't handle all https://www.ejabberd.im/node/482#comment-1028 <blockquote><p>Maybe it can't handle all the users in my LDAP tree (~13,000)?</p></blockquote> <p>Looking at the error message, it seems possible:</p> <pre> error_info: {timeout,{gen_fsm,sync_send_event, ['eldap_ejabberd_chatty.mcc.edu', {search, {eldap_search, wholeSubtree, "dc=mcc,dc=edu", {present,"uid"}, ["uid"], false, 0}}]}}</pre><p> With so many users, it could be the default timeout happens without receiving the answer. </p> <p>If you are still interested in that list of users, you can try to increment those constants defined in ejabberd/src/eldap/eldap.erl (maybe they are related to the timeout you experience):</p> <pre>-define(RETRY_TIMEOUT, 5000). -define(BIND_TIMEOUT, 10000). -define(CMD_TIMEOUT, 5000).</pre><p>Of course, that's not possible right now as you can't compile from source.</p> Thu, 10 Nov 2005 10:10:24 +0000 mfoss comment 1028 at https://www.ejabberd.im That helps https://www.ejabberd.im/node/482#comment-1027 <p>I can do the workaround by going to <noindex><a href="http://host:5280/admin/server/host/" title="http://host:5280/admin/server/host/" rel="nofollow" >http://host:5280/admin/server/host/</a></noindex> and it pulls up shared roster and all is good. If I click on Users, it crashes again. I'm assuming its trying to pull up a list of User from LDAP? Maybe it can't handle all the users in my LDAP tree (~13,000)?</p> <p>I compiled ejabberd (0.9.8) from source, but I couldn't get it to run. It just always produces a erl_crash.dump that is really big.</p> <p>I've read something about this when doing a Google search -- it seems other(s) have had this problem in the past:</p> <p><noindex><a href="http://lists.jabber.ru/pipermail/ejabberd/2004-July/000154.html" title="http://lists.jabber.ru/pipermail/ejabberd/2004-July/000154.html" rel="nofollow" >http://lists.jabber.ru/pipermail/ejabberd/2004-July/000154.html</a></noindex></p> <p>Thanks,</p> <p>Marc</p> Wed, 09 Nov 2005 21:50:36 +0000 msmith comment 1027 at https://www.ejabberd.im Try this workaround https://www.ejabberd.im/node/482#comment-1019 <p>Something about ldap appears there. It could be a bug related to LDAP, but in that case somebody else would have found it previously, and this is the first time I read about it. </p> <p>You use the FreeBSD port, but I doubt that port introduced any new code that could produce the error. One thing you could try is to compile ejabberd from source.</p> <p>Workaround: if you are lucky, the bug only affects '/admin/vhosts/'. If so, maybe you can access the virtual host directly at '/admin/server/chatty.mcc.edu/'.</p> Sun, 06 Nov 2005 21:50:54 +0000 mfoss comment 1019 at https://www.ejabberd.im