[ejabberd] "killall -9 firefox" can not make JWCHAT's client offline on ejabberd-2.0.3 !

Stefan Strigler steve at zeank.in-berlin.de
Mon Mar 30 19:14:54 MSD 2009


Hi,

if you do a "killall -9 firefox" the underlying tcp/ip connection to  
ejabberd's web service won't be closed correctly. So it will wait  
until the current http request times out which is defined by the  
'wait' attribute you're using. 'inactivity' instead denotes the  
timeout between subsequent requests (i.e. if one request has finished  
and another is to be made).

Cheers, Steve

Am 30.03.2009 um 16:46 schrieb Xia Qingran:

> Maybe this timeout is in the lower level like ejabberd_http.erl. I
> want to change following code:
>
> =========================
>    Data = SockMod:recv(Socket, 0, 300000),
>    ... ...
>                case (State#state.sockmod):recv(State#state.socket,
> 0, 300000) of
> =========================
>
> I will try all of them in two days, and give you the result of my  
> experiment.
>
> Qingran
>
>
> 2009/3/30 Jorge Guntanis <jorge at guntanis.com>:
>> Also you will have to recompile after this change.
>>
>> 2009/3/29 Jorge Guntanis <jorge at guntanis.com>
>>>
>>> Seems like you would have change this:
>>> ejabberd_http_poll.erl:-define(HTTP_POLL_TIMEOUT, 300000).
>>> to:
>>> ejabberd_http_poll.erl:-define(HTTP_POLL_TIMEOUT, 30000).
>>>
>>> Jorge.
>>>
>>> 2009/3/29 Xia Qingran <qingran.xia at gmail.com>
>>>>
>>>> 2009/3/28 Jorge Guntanis <jorge at guntanis.com>
>>>>>
>>>>> I think this is discussed and fixed on this thread:
>>>>> http://www.ejabberd.im/node/2704
>>>>>
>>>>> Have you tried that already?
>>>>
>>>> Thanks, I have read this. In my case, I found out that the  
>>>> session of
>>>> offline users will disappear in 5 minutes, but I want to set this  
>>>> timeout
>>>> much more shorter like  30 seconds of http_bind .
>>>>
>>>> I find out every 8 seconds the server side will response a "TCP  
>>>> ack"
>>>> response to detect the whether the permanent connection is alive  
>>>> between the
>>>> server and client. The package is like that below:
>>>>
>>>> ==============================================================
>>>> # tcpdump -X -i eth1 port 80 and host mydomain.org
>>>> 17:35:27.057597 IP mydomain.org.www > 192.168.2.63.56245: . ack 1  
>>>> win
>>>> 33120
>>>>    0x0000:  4500 0028 0f4a 4000 3306 0337 d233 a034  E..(.J at . 
>>>> 3..7.3.4
>>>>    0x0010:  c0a8 023f 0050 dbb5 9d94 36d1 4766 6ee2  ...?.P.... 
>>>> 6.Gfn.
>>>>    0x0020:  5010 8160 9270 0000 0000 0000 0000       P..`.p........
>>>> 17:35:27.057641 IP 192.168.2.63.56245 > mydomain.org.www: . ack 1  
>>>> win
>>>> 1002 <nop,nop,timestamp 6075364 860882153>
>>>>    0x0000:  4500 0034 11b4 4000 8106 b2c0 c0a8 023f  E.. 
>>>> 4.. at ........?
>>>>    0x0010:  d233 a034 dbb5 0050 4766 6ee2 9d94 36d2  . 
>>>> 3.4...PGfn...6.
>>>>    0x0020:  8010 03ea ea54 0000 0101 080a 005c b3e4  .....T....... 
>>>> \..
>>>>    0x0030:  3350 04e9                                3P..
>>>> ==============================================================
>>>>
>>>> Therefore the server side will know the JWCHAT client offline in  8
>>>> seconds.
>>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>> 2009/3/27 Xia Qingran <qingran.xia at gmail.com>
>>>>>>
>>>>>> Yeah, you are right. When I directly kill firefox browser, the  
>>>>>> JWCHAT
>>>>>> will not send right presence to server. The only thing I want  
>>>>>> to know is
>>>>>> that whether "max_inactivity" of http_bind is the timeout to  
>>>>>> release the
>>>>>> idle no-existed connection sessions.
>>>>>>
>>>>>> In the source code of ejabberd_http_bind.erl
>>>>>> (http://svn.process-one.net/ejabberd-modules/http_bind/trunk/src/web/ejabberd_http_bind.erl 
>>>>>> ),
>>>>>> I found out the followings:
>>>>>> -define(MAX_INACTIVITY, 30000). % msecs to wait before  
>>>>>> terminating
>>>>>>                                % idle sessions
>>>>>>
>>>>>> Therefore I think max_inactivity is the parameter which can  
>>>>>> terminate
>>>>>> the idle session. But in my case, it is not working.
>>>>>>
>>>>>> Qingran
>>>>>>
>>>>>> 2009/3/28 Jorge Guntanis <jorge at guntanis.com>
>>>>>>>
>>>>>>> Probably your jabber client is not sending the presence  
>>>>>>> change, so
>>>>>>> ejabberd does not know that your visitor left.
>>>>>>> This is by no means a problem with ejabberd, what you should  
>>>>>>> make sure
>>>>>>> is that when the window closes, or the visitor leaves you are  
>>>>>>> having your
>>>>>>> jabber client to let the server know.
>>>>>>> Or have jabber sessions time out faster?
>>>>>>>
>>>>>>> Jorge
>>>>>>>
>>>>>>>
>>>>>>> 2009/3/27 Xia Qingran <qingran.xia at gmail.com>
>>>>>>>>
>>>>>>>> Additionally, I find out that after nearly 4 minutes, the  
>>>>>>>> offline
>>>>>>>> users always disappear in the list of "ejabberdctl connected- 
>>>>>>>> users" whatever
>>>>>>>> the value of "max_inactivity".
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> 2009/3/27 Xia Qingran <qingran.xia at gmail.com>
>>>>>>>>>
>>>>>>>>> Hi, everyone,
>>>>>>>>>
>>>>>>>>> Is anyone tell me how to take the http_bind's inactive users
>>>>>>>>> offline?
>>>>>>>>>
>>>>>>>>> My website's XMPP service is taking use of JWCHAT and
>>>>>>>>> ejabberd-2.0.3's http_bind on Ubuntu Linux.
>>>>>>>>>
>>>>>>>>> I found out that lots of visitors are online by "ejabberdctl
>>>>>>>>> connected-users", but in fact most of them have gone offline  
>>>>>>>>> by checking our
>>>>>>>>> website's session universal storage.
>>>>>>>>>
>>>>>>>>> By the way, when I use "killall -9 firefox on my desktop",  
>>>>>>>>> on the
>>>>>>>>> server side I found my account is still online. Then I make  
>>>>>>>>> "max_inactivity"
>>>>>>>>> to 10. However after 10 seconds the inactive users are still  
>>>>>>>>> online.
>>>>>>>>> Therefore I think many visitor directly shut down the  
>>>>>>>>> browser, and
>>>>>>>>> ejabberd's does not take the inactive or timeout user offline.
>>>>>>>>>
>>>>>>>>> The contents of ejabberd.cfg are listed as follows:
>>>>>>>>> ==========================================
>>>>>>>>> {loglevel, 5}.
>>>>>>>>>
>>>>>>>>> {hosts, ["mydomain.org"]}.
>>>>>>>>>
>>>>>>>>> {listen,
>>>>>>>>> [
>>>>>>>>>
>>>>>>>>>  {5222, ejabberd_c2s, [
>>>>>>>>>            {certfile, "/usr/local/ejabberd-2.0.4/conf/ 
>>>>>>>>> server.pem"},
>>>>>>>>> starttls,
>>>>>>>>>            {access, c2s},
>>>>>>>>>            {shaper, c2s_shaper},
>>>>>>>>>            {max_stanza_size, 65536}
>>>>>>>>>               ]},
>>>>>>>>>
>>>>>>>>>  {5280, ejabberd_http, [
>>>>>>>>>             http_bind,
>>>>>>>>>             web_admin
>>>>>>>>>            ]}
>>>>>>>>> ]}.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> {auth_method, external}.
>>>>>>>>> {extauth_program,
>>>>>>>>> "/usr/local/ejabberd-2.0.4/bin/ejabberd_extauh.py"}.
>>>>>>>>>
>>>>>>>>> {odbc_server, {pgsql, "localhost", "ejabberd", "ejabberd",
>>>>>>>>> "ejabberd"}}.
>>>>>>>>> {odbc_pool_size, 5}.
>>>>>>>>>
>>>>>>>>> {pgsql_users_number_estimate, true}.
>>>>>>>>>
>>>>>>>>> {shaper, normal, {maxrate, 5000000}}.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> {shaper, fast, {maxrate, 50000000}}.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> {acl, admin, {user, "qingran", "mydomain.org"}}.
>>>>>>>>>
>>>>>>>>> {acl, local, {user_regexp, ""}}.
>>>>>>>>>
>>>>>>>>> {access, max_user_sessions, [{5, all}]}.
>>>>>>>>>
>>>>>>>>> {access, local, [{allow, local}]}.
>>>>>>>>>
>>>>>>>>> {access, c2s, [{deny, blocked},
>>>>>>>>>           {allow, all}]}.
>>>>>>>>>
>>>>>>>>> {access, c2s_shaper, [{none, admin},
>>>>>>>>>              {normal, all}]}.
>>>>>>>>>
>>>>>>>>> {access, s2s_shaper, [{deny, all}]}.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> {access, announce, [{allow, admin}]}.
>>>>>>>>>
>>>>>>>>> {access, configure, [{allow, admin}]}.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> {access, muc_admin, [{allow, admin}]}.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> {access, muc, [{allow, all}]}.
>>>>>>>>>
>>>>>>>>> {access, register, [{deny, all}]}.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> {access, pubsub_createnode, [{allow, all}]}.
>>>>>>>>>
>>>>>>>>> {language, "en"}.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> %%%   =======
>>>>>>>>> %%%   MODULES
>>>>>>>>>
>>>>>>>>> %%
>>>>>>>>> %% Modules enabled in all ejabberd virtual hosts.
>>>>>>>>> %%
>>>>>>>>> {modules,
>>>>>>>>> [
>>>>>>>>>  {mod_adhoc,    []},
>>>>>>>>>  {mod_announce, [{access, announce}]}, % requires mod_adhoc
>>>>>>>>>  {mod_caps,     []},
>>>>>>>>>  {mod_configure,[]}, % requires mod_adhoc
>>>>>>>>>  {mod_disco,    []},
>>>>>>>>>
>>>>>>>>>  {mod_http_bind,[ {max_inactivity, 10} ]},
>>>>>>>>>
>>>>>>>>>  {mod_offline,  []},
>>>>>>>>>  {mod_privacy_odbc,  []},
>>>>>>>>>  {mod_private_odbc,  []},
>>>>>>>>>
>>>>>>>>>  {mod_pubsub,   [ % requires mod_caps
>>>>>>>>>          {access_createnode, pubsub_createnode},
>>>>>>>>>          {plugins, ["default", "pep"]}
>>>>>>>>>         ]},
>>>>>>>>>  {mod_roster_odbc,   []},
>>>>>>>>>
>>>>>>>>>  {mod_shared_roster,[]},
>>>>>>>>>
>>>>>>>>>  {mod_time,     []},
>>>>>>>>>  {mod_vcard_odbc,    []},
>>>>>>>>>  {mod_version,  []}
>>>>>>>>> ]}.
>>>>>>>>>
>>>>>>>>> = 
>>>>>>>>> ==============================================================
>>>>>>>>> Thanks very much.
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> 夏清然
>>>>>>>>> Xia Qingran
>>>>>>>>> qingran.xia at gmail.com
>>>>>>>>> Sent from: Beijing 11 China.
>>>>>>>>> Isaac Asimov  - "I do not fear computers. I fear the lack of  
>>>>>>>>> them."
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> 夏清然
>>>>>>>> Xia Qingran
>>>>>>>> qingran.xia at gmail.com
>>>>>>>>
>>>>>>>> Yogi Berra  - "A nickel ain't worth a dime anymore."
>>>>>>>> _______________________________________________
>>>>>>>> ejabberd mailing list
>>>>>>>> ejabberd at jabber.ru
>>>>>>>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> ejabberd mailing list
>>>>>>> ejabberd at jabber.ru
>>>>>>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 夏清然
>>>>>> Xia Qingran
>>>>>> qingran.xia at gmail.com
>>>>>>
>>>>>> P. J. O'Rourke  - "If government were a product, selling it  
>>>>>> would be
>>>>>> illegal."
>>>>>> _______________________________________________
>>>>>> ejabberd mailing list
>>>>>> ejabberd at jabber.ru
>>>>>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ejabberd mailing list
>>>>> ejabberd at jabber.ru
>>>>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 夏清然
>>>> Xia Qingran
>>>> qingran.xia at gmail.com
>>>>
>>>> P. J. O'Rourke  - "If government were a product, selling it would  
>>>> be
>>>> illegal."
>>>> _______________________________________________
>>>> ejabberd mailing list
>>>> ejabberd at jabber.ru
>>>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>>>
>>>
>>
>>
>> _______________________________________________
>> ejabberd mailing list
>> ejabberd at jabber.ru
>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>
>>
>
>
>
> -- 
> 夏清然
> Xia Qingran
> qingran.xia at gmail.com
> Sent from: Beijing 11 China.
> Rodney Dangerfield  - "I haven't spoken to my wife in years. I didn't
> want to interrupt her."
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd



More information about the ejabberd mailing list