irssi-import / bugs.irssi.org

bugs.irssi.org archive
https://github.com/irssi/irssi/issues
0 stars 0 forks source link

sig11 on reconnect in 0.8.10a #401

Open irssibot opened 18 years ago

irssibot commented 18 years ago

For some time now, irssi sig11's on reconnect. Interestingly i have this effect only on IRCNet, all other reconnect just fine.

I tracked this down to irc_server_init_connect() returning a NULL value instead of a valid pointer. This is then passed trough server_connect() (server.c:320) to irc_server_connect() (irc_servers.c:246) which then causes a segfault when trying to access server->connrec.

Interestingly, i could not find out why irc_server_init_connect() would return NULL, it is initialized very early and used trough the whole function.

To debug this i added a few assert()'s trough the code, thus my line numbers might be off by one or two:

---
(gdb) bt
#0  0xb7bcd83b in raise () from /lib/tls/libc.so.6
#1  0xb7bcefa2 in abort () from /lib/tls/libc.so.6
#2  0xb7bc72df in __assert_fail () from /lib/tls/libc.so.6
#3  0x080d667e in server_connect (conn=0x80fc907) at servers.c:322
#4  0x080d7639 in server_reconnect_timeout () at servers-reconnect.c:129
#5  0xb7d40c9c in g_main_context_wakeup () from /usr/lib/libglib-2.0.so.0
#6  0xb7d3e582 in g_main_depth () from /usr/lib/libglib-2.0.so.0
#7  0xb7d3f5f8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#8  0xb7d3f930 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#9  0xb7d3fb7d in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#10 0x0806f132 in main (argc=135367368, argv=0xb7d99398) at irssi.c:388
(gdb) up 3
#3  0x080d667e in server_connect (conn=0x80fc907) at servers.c:322
322     }
(gdb) l
317             server = proto->server_init_connect(conn);
318             assert(server);
319             proto->server_connect(server);
320     
321             return server;
322     }
323     
324     /* initializes server record but doesn't start connecting */
325     void server_connect_init(SERVER_REC *server)
326     {
(gdb) p *proto 
$3 = {id = 67, not_initialized = 0, case_insensitive = 1, 
  name = 0x811b350 "IRC", fullname = 0x80fc2c7 "Internet Relay Chat", 
  chatnet = 0x80fc6de "ircnet", create_chatnet = 0x80a3c90 <create_chatnet>, 
  create_server_setup = 0x80a3cb0 <create_server_setup>, 
  create_channel_setup = 0x80a3cd0 <create_channel_setup>, 
  create_server_connect = 0x80a3cf0 <create_server_connect>, 
  destroy_server_connect = 0x80a3d10 <destroy_server_connect>, 
  server_init_connect = 0x80abd70 <irc_server_init_connect>, 
  server_connect = 0x80abf70 <irc_server_connect>, 
  channel_create = 0x80a3ef0 <irc_channel_create>, 
  query_create = 0x80ab440 <irc_query_create>}
(gdb) p server
$1 = (SERVER_REC *) 0x80fc907
---

Please don't ask me why server shows here up as !=0, i have no explanation myself.

System i run it on is a debian stable, libc has version 2.3.2.ds1-22, gcc 3.3.5 (Debian 1:3.3.5-13)

irssibot commented 16 years ago

irc_server_init_connect returns NULL if conn->address or conn->nick is either NULL or the empty string, is this the case?