jrfoell / campfire-libpurple

A Campfire protocol plugin for libpurple (Pidgin)
48 stars 16 forks source link

campfire_userlist_callback error #11

Closed wuputah closed 12 years ago

wuputah commented 12 years ago

This adapter works great for a bit but seems to crash pidgin within 30 minutes or so. Can you advise how to debug this further?

I ran pidgin using gdb and was able to get a trace:

Program received signal SIGPIPE, Broken pipe.
0x00007ffff4e5a7e7 in send () from /lib/libpthread.so.0
(gdb) bt
#0  0x00007ffff4e5a7e7 in send () from /lib/libpthread.so.0
#1  0x00007fffe8f1c3cb in ?? () from /lib/libnspr4.so
#2  0x00007fffe9ce674b in ssl_DefSend () from /lib/libssl3.so
#3  0x00007fffe9cd8210 in ssl3_SendRecord () from /lib/libssl3.so
#4  0x00007fffe9cd8529 in ssl3_SendApplicationData () from /lib/libssl3.so
#5  0x00007fffe9ceb981 in ssl_SecureSend () from /lib/libssl3.so
#6  0x00007fffe9cef977 in ssl_Write () from /lib/libssl3.so
#7  0x00007fffe9f0ca75 in ?? () from /usr/lib/purple-2/ssl-nss.so
#8  0x00007fffe69f25d9 in ?? () from /usr/lib/purple-2/libjabber.so.0
#9  0x00007fffe69f2a2c in jabber_send_raw () from /usr/lib/purple-2/libjabber.so.0
#10 0x00007fffe69f338f in jabber_close () from /usr/lib/purple-2/libjabber.so.0
#11 0x00007ffff50c1f86 in _purple_connection_destroy () from /lib/libpurple.so.0
#12 0x00007ffff50ada8e in purple_account_disconnect () from /lib/libpurple.so.0
#13 0x00007ffff50c1225 in ?? () from /lib/libpurple.so.0
#14 0x00007ffff53e300b in ?? () from /lib/libglib-2.0.so.0
#15 0x00007ffff53e2475 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#16 0x00007ffff53e27a8 in ?? () from /lib/libglib-2.0.so.0
#17 0x00007ffff53e2ba2 in g_main_loop_run () from /lib/libglib-2.0.so.0
#18 0x00007ffff6649477 in gtk_main () from /lib/libgtk-x11-2.0.so.0
#19 0x00000000004319e1 in main ()

Interesting that I don't see the campfire lib in the history - I should note that I'm also connected to XMPP. Could the two be conflicting in some way?

Let me know if I can help further.

msteinert commented 12 years ago

The Pidgin website has a good writeup on how to get a backtrace and specifically how to ignore SIGPIPE in GDB. It would also probably be useful to install the Pidgin debug or dev packages for Pidgin.

Also, make sure that campfire-libpurple was compiled with debugging symbols and isn't stripped (this should be the default situation in the latest commit).

I've been trying to reproduce a crash myself so I'm very curious to see your result!

jfoell commented 12 years ago

@wuputah, All of the debugging I've done has been with output statements using 'pidgin -d'. I've also done a bit of work using 'valgrind' per the pidgin developers guidelines (to find and fix memory leaks). I am interested to know if the plugin crashes without other protocols running (XMPP, etc.). I agree that your trace doesn't really point to something campfire-plugin related.

msteinert commented 12 years ago

I think I reproduced this.

#0  0x017e5225 in campfire_userlist_callback (xaction=0x880b028, 
    gsc=0x881dff8, cond=PURPLE_INPUT_READ) at message.c:134
#1  0x017e6437 in campfire_ssl_handler (campfire=0x86cbdc0, gsc=0x881dff8, 
    cond=PURPLE_INPUT_READ) at http.c:420
#2  0x0106d55d in recv_cb (data=0x881dff8, source=19, cond=PURPLE_INPUT_READ)
    at sslconn.c:155
#3  0x080aa033 in pidgin_io_invoke (source=0x87db580, condition=G_IO_IN, 
    data=0x8720b60) at gtkeventloop.c:73
#4  0x00f6f72d in g_io_unix_dispatch (source=0x8826b30, 
    callback=0x80a9ff0 <pidgin_io_invoke>, user_data=0x8720b60)
    at giounix.c:166
#5  0x00f2e99e in g_main_dispatch (context=0x813b200) at gmain.c:2539
#6  g_main_context_dispatch (context=0x813b200) at gmain.c:3075
#7  0x00f312ca in g_main_context_iterate (context=0x813b200, block=1, 
    dispatch=1, self=0x8691b60) at gmain.c:3146
#8  0x00f31499 in g_main_loop_run (loop=0x868eef8) at gmain.c:3340
#9  0x005bc654 in IA__gtk_main () at gtkmain.c:1256
#10 0x080c5279 in main (argc=Cannot access memory at address 0x2) at gtkmain.c:934

Have a look at the value of chatusers:

(gdb) print chatusers
$1 = (GList *) 0x2

Whoops, that's not a pointer. Apparently calling purple_conv_chat_remove_user() modifies the list we're currently iterating over. A proposed patch is here: 52110a1ca3

wuputah commented 12 years ago

I just got a stacktrace matching yours. Applying your patch...

msteinert commented 12 years ago

@wuputah, Is this working for you now? I've been running with this patch since Friday without a crash.

wuputah commented 12 years ago

Yes, it's working great. Let's close this out.

msteinert commented 12 years ago

Great news, thanks for testing it out!