Ticket #57 (closed defect)
c2s crashes for dead loop
| Reported by: | smoku | Owned by: | smoku |
|---|---|---|---|
| Priority: | major | Component: | c2s |
| Version: | 2.1 | Keywords: | |
| Cc: | Tracforge_linkmap: | ||
| Blocking: | Blocked By: |
Description
This is the log , I had modify some code , so the line of sources in the log file is not same jabberd-s11.
sx (io.c:70) completed nad: <route xmlns='http://jabberd.jabberstudio.org/ns/component/1.0' from='im800.net' to='c2s'><sc:session xmlns:sc='http://jabberd.jabberstudio.org/ns/session/1.0' action='replaced' sc:sm='f14317dae5afaf5bfa2384a7bddacc4437dde166' sc:c2s='c1ff443bcf804faa3137fd50d5a48d745eb9b871'/></route> sx (chain.c:119) calling nad read chain sx (io.c:123) tag 6 event 6 data 0x8c97b90 sx (error.c:79) prepared error: <stream:error xmlns:stream='http://etherx.jabber.org/streams'><conflict xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error> sx (error.c:94) tag 10 event 1 data 0x0 Tue Jun 13 10:07:15 2006 c2s.c:38 want write Tue Jun 13 10:07:15 2006 c2s.c:399 write action on fd 10 sx (io.c:292) 10 ready for writing sx (io.c:311) handing app 602 bytes to write sx (io.c:312) tag 10 event 3 data 0x8e97c60 Tue Jun 13 10:07:15 2006 c2s.c:104 writing to 10 sx (io.c:345) tag 10 event 0 data 0x0 Tue Jun 13 10:07:15 2006 c2s.c:33 want read sx (io.c:439) 10 state change from 4 to 5 sx (io.c:450) tag 10 event 1 data 0x0 Tue Jun 13 10:07:15 2006 c2s.c:38 want write Tue Jun 13 10:07:15 2006 c2s.c:399 write action on fd 10 sx (io.c:292) 10 ready for writing sx (io.c:311) handing app 602 bytes to write sx (io.c:312) tag 10 event 3 data 0x8e97c60 Tue Jun 13 10:07:15 2006 c2s.c:104 writing to 10 sx (io.c:345) tag 10 event 0 data 0x0 .... .... .... Tue Jun 13 10:07:48 2006 main.c:592 running time checks sx (error.c:79) prepared error: <stream:error xmlns:stream='http://etherx.jabber.org/streams'><host-gone xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xmlns='urn:ietf:params:xml:ns:xmpp-streams'>connection timed out</text></stream:error> sx (error.c:94) tag 10 event 1 data 0x0 Tue Jun 13 10:07:48 2006 c2s.c:38 want write Tue Jun 13 10:07:48 2006 c2s.c:399 write action on fd 10 sx (io.c:292) 10 ready for writing sx (io.c:311) handing app 602 bytes to write sx (io.c:312) tag 10 event 3 data 0x8e97c60 Tue Jun 13 10:07:48 2006 c2s.c:104 writing to 10 sx (io.c:345) tag 10 event 0 data 0x0 Tue Jun 13 10:07:48 2006 c2s.c:33 want read sx (error.c:79) prepared error: <stream:error xmlns:stream='http://etherx.jabber.org/streams'><host-gone xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xmlns='urn:ietf:params:xml:ns:xmpp-streams'>connection timed out</text></stream:error> sx (error.c:94) tag 10 event 1 data 0x0 Tue Jun 13 10:07:48 2006 c2s.c:38 want write Tue Jun 13 10:07:48 2006 c2s.c:399 write action on fd 10 sx (io.c:292) 10 ready for writing sx (io.c:311) handing app 602 bytes to write sx (io.c:312) tag 10 event 3 data 0x8e97c60 Tue Jun 13 10:07:48 2006 c2s.c:104 writing to 10 sx (io.c:345) tag 10 event 0 data 0x0 Tue Jun 13 10:07:48 2006 c2s.c:33 want read sx (error.c:79) prepared error: <stream:error xmlns:stream='http://etherx.jabber.org/streams'><host-gone xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xmlns='urn:ietf:params:xml:ns:xmpp-streams'>connection timed out</text></stream:error> sx (error.c:94) tag 10 event 1 data 0x0 Tue Jun 13 10:07:48 2006 c2s.c:38 want write Tue Jun 13 10:07:48 2006 c2s.c:399 write action on fd 10 sx (io.c:292) 10 ready for writing sx (io.c:311) handing app 602 bytes to write sx (io.c:312) tag 10 event 3 data 0x8e97c60 Tue Jun 13 10:07:48 2006 c2s.c:104 writing to 10 .... the following is the dead loop
I parses the c2s source and finds a problem in the c2s
static void _c2s_time_checks(c2s_t c2s) {
sess_t sess;
time_t now;
union xhashv xhv;
now = time(NULL);
if(xhash_iter_first(c2s->sessions))
do {
xhv.sess_val = &sess;
xhash_iter_get(c2s->sessions, NULL, xhv.val);
if(c2s->io_check_idle > 0 && now > sess->last_activity +
c2s->io_check_idle) {
log_write(c2s->log, LOG_NOTICE, "[%d] [%s, port=%d] timed out",
sess->fd, sess->ip, sess->port);
sx_error(sess->s, stream_err_HOST_GONE, "connection timed
out");
sx_close(sess->s);
continue;
}
if(c2s->io_check_keepalive > 0 && now > sess->last_activity +
c2s->io_check_keepalive && sess->s->state >= state_STREAM) {
log_debug(ZONE, "sending keepalive for %d", sess->fd);
sx_raw_write(sess->s, " ", 1);
}
} while(xhash_iter_next(c2s->sessions));
}
it is a problem in calling the sx_close() when the state of sx is state_CLOSING. The sx_close() does not close the sx and the sx_close() return immediately . this will cause to the _c2s_time_checks() dead loop.
Change History
Note: See
TracTickets for help on using
tickets.
