[JDEV] Is this bug fixed after 1.2 ?

Dennis Noordsij dennis.noordsij at wiral.com
Mon Jan 8 11:02:14 CST 2001


>On Friday 01 December 2000 18:08, you wrote:
> However, in the case where you have a xdb_get followed by a xdb_set
> (eg. to store an offline message), the xdb_get will timeout nicely,
> then the xdb_set will do a segfault on the following line :
>
> [jabberd/io/base_load.c:xdb_set()]
>
>         pth_mutex_acquire(&mutex, FALSE, NULL);
>
> But there I've no clue :(
>
> For now, handling correctly all namespaces seems the safest way ...

Hello, sorry for the long email, but I have to tried to include as much 
information as possible, it appears to be a real problem (don't know if it 
has been fixed) with other people posting about it in the past.


I am trying to split up the XDB section to have the original xdb_file.so 
module handle everything except the jabber:x:offline namespace.

In jabber.xml, I add

	<ns>jabber:iq:auth</ns>
	<ns>jabber:iq:roster</ns>
	<ns>jabber:iq:register</ns>
	<ns>vcard-temp</ns>

to the xdb section.


I then add a new xdb entry, set <ns>jabber:x:offline</ns> and the appropriate 
<accept> tag. This program (external, uses libxode, libjabber and libpthread) 
connects and handshakes with jabber.

I want this program to handle all offline messages. 

Events that happen:

- jabber starts
- offline program connects and handshakes
- I try to log in using Gabber
- offline program sees this:

 RECEIVED:
 <xdb type='get' to='dennis at host/jabber:x:offline'
          from='host' id='4'/>

 REPLIED:
 <xdb type='result' from='dennis at host/jabber:x:offline' 
     to='host' id='4'><offline xmlns='jabber:x:offline'/></xdb>

 CONNECTION TO JABBER LOST

- In the mean time, jabber saw this:

Mon Jan  8 19:13:50 2001  deliver.c:472 DELIVER 2:host <xdb
     type='get' to='dennis at host/jabber:x:offline'
     from='host' id='4'/>
Mon Jan  8 19:13:50 2001  deliver.c:344 delivering to instance 'offlineagent'
Mon Jan  8 19:13:50 2001  deliver.c:344 delivering to instance 'xdb'
Mon Jan  8 19:13:50 2001  deliver.c:278 delivery failed (Server Configuration 
Error)

(Note, the external program is called 'offlineagent', 'xdb' is the original 
xdb entry with <ns> tags added).

- Even though jabber claims to deliver the xdb_get to instance 'xdb' I have 
patched the xdb_file.c file to log a notice when a jabber:x:offline request 
is received; in this case it never sees one. (as hoped :-)

- Next, jabber notices the reply from the external program:

Mon Jan  8 19:13:50 2001  base_accept.c:341 io incoming message event for 14

Mon Jan  8 19:13:50 2001  base_accept.c:328 io read event for 14

Mon Jan  8 19:13:50 2001  base_accept.c:213 base_accept: <xdb type='result' 
     from='dennis at host/jabber:x:offline' to='host'
     id='4'><offline xmlns='jabber:x:offline'/></xdb>

Mon Jan  8 19:13:50 2001  deliver.c:472 DELIVER 1:host <xdb
     type='result' from='dennis at host/jabber:x:offline'
     to='host' id='4'><offline xmlns='jabber:x:offline'/></xdb>

Mon Jan  8 19:13:50 2001  deliver.c:344 delivering to instance 'sessions'

Mon Jan  8 19:13:50 2001  base_load.c:167 xdb_results checking xdb packet
     <xdb type='result' from='dennis at host/jabber:x:offline'
     to='host' id='4'><offline xmlns='jabber:x:offline'/></xdb>

Mon Jan  8 19:13:50 2001  base_load.c:327 xdb_get() done waiting for
     dennis at host jabber:x:offline

- Well, so far it all looked good.

Mon Jan  8 19:13:50 2001  deliver.c:472 DELIVER 2:host <xdb
     type='set' to='dennis at host/jabber:x:offline'
     from='host' id='5'><offline xmlns='jabber:x:offline'/></xdb>

Mon Jan  8 19:13:50 2001  deliver.c:344 delivering to instance 'offlineagent'

Mon Jan  8 19:13:50 2001  deliver.c:344 delivering to instance 'xdb'

Mon Jan  8 19:13:50 2001  deliver.c:278 delivery failed (Server Configuration 
Error)

Mon Jan  8 19:13:50 2001  log.c:105 <log type='warn'
     from='host'>dropping an xdb request for
     dennis at host/jabber:x:offline</log>

Mon Jan  8 19:13:50 2001  deliver.c:472 DELIVER 3:host <log
     type='warn' from='host'>dropping an xdb request for
     dennis at host/jabber:x:offline</log>

Mon Jan  8 19:13:50 2001  deliver.c:344 delivering to instance 'logger'
     20010108T17:13:50: [warn] (host): dropping an xdb request    
     for dennis at host/jabber:x:offline

Mon Jan  8 19:13:50 2001  base_load.c:378 xdb_set() waiting for
     dennis at host jabber:x:offline



At this point jabber has segfaulted. The external component has never seen 
any data on the socket after this initial request, and shut down because the 
socket was closed. 


> However, in the case where you have a xdb_get followed by a xdb_set
> (eg. to store an offline message), the xdb_get will timeout nicely,
> then the xdb_set will do a segfault on the following line :
>
> [jabberd/io/base_load.c:xdb_set()]
>
>         pth_mutex_acquire(&mutex, FALSE, NULL);
>
> But there I've no clue :(

Sounds like this is my problem :-)



> For now, handling correctly all namespaces seems the safest way ...

But I *am* handling all namespaces correctly as far as I know. For some 
reason the <ns> tags are not enough to tell jabber to not approach the 
xdb_file.so module for jabber:x:offline messages (but I guess it does, and 
then fails, hence the delivery failed (Server Configuration Error) - and then 
when no reply comes in from that component (even though there can't be one at 
all anyway) jabber segfaults.


Also, when I don't put in the <ns> tags in the jabber.xml file my external 
component receives all jabber:x:offline messages, even replies to them, but 
the xdb_file.so module seems to 'win'. No crashes, but no point in my program 
either :-) 

If I patch the xdb_file.so module to ignore jabber:x:offline messages, there 
is no Server Configuration Error when sending the get request, the rest of 
the events are the same, ie the get is received and responded to properly, 
then a set is sent but jabber segfaults (external program never sees the set 
though).


Does it help if I go to 1.4 ? :-)


Kind regards,
Dennis




More information about the JDev mailing list