Package: pidgin-skype
Version: 20130613+svn660+dfsg-1
Severity: grave
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi!

Since some time, pidgin-skype is unable to establish communication
with Skype and crashes when it tries to. This is 100% reproducible on
my setup. This bug seems to be already reported upstream:

 https://code.google.com/p/skype4pidgin/issues/detail?id=239

Here is a backtrace:

#0  0x00007ffff4764077 in __GI_raise (sig=sig@entry=6) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:56
        resultvar = 0
        pid = 28522
        selftid = 28522
#1  0x00007ffff4765458 in __GI_abort () at abort.c:89
        save_stage = 2
        act = {
          __sigaction_handler = {
            sa_handler = 0x55555622f2b0,
            sa_sigaction = 0x55555622f2b0
          },
          sa_mask = {
            __val = {140737307444736, 93825003648256, 140737351949831, 5, 0, 
44, 140737294589224, 0, 93825003648256, 93825000110608, 140737351975717, 44, 
140737295450653, 44, 140737308113920, 0}
          },
          sa_flags = -189974640,
          sa_restorer = 0x7ffff541bce0
        }
        sigs = {
          __val = {32, 0 <repeats 15 times>}
        }
#2  0x00007ffff53bb95d in g_mutex_unlock_slowpath (mutex=<optimized out>, 
prev=<optimized out>) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gthread-posix.c:1327
No locals.
#3  0x00007ffff53bc38e in g_mutex_unlock (mutex=<optimized out>) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gthread-posix.c:1350
        prev = <optimized out>
#4  0x00007ffff53bc5ce in g_cond_wait_until (cond=0x555556037500, 
mutex=0x555555cd7a10, end_time=<optimized out>) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gthread-posix.c:1442
        now = {
          tv_sec = 273990,
          tv_nsec = 37210622
        }
        span = {
          tv_sec = 9,
          tv_nsec = 999985378
        }
        sampled = 0
        res = <optimized out>
#5  0x00007ffff534a8ca in g_cond_timed_wait (cond=<optimized out>, 
mutex=<optimized out>, abs_time=abs_time@entry=0x7fffffffbfa0) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/deprecated/gthread-deprecated.c:1578
        end_time = <optimized out>
#6  0x00007fffe5207fbc in skype_send_message 
(message_format=message_format@entry=0x7fffe520fc7c "NAME %s") at 
skype_messaging.c:235
        next_message_num = 1
        cur_message_num = 0
        message = 0x5555561cc3e0 "\340\304\034VUU"
        return_msg = <optimized out>
        args = {{
            gp_offset = 8,
            fp_offset = 48,
            overflow_arg_area = 0x7fffffffc090,
            reg_save_area = 0x7fffffffbfd0
          }}
        condition_result = <optimized out>
        endtime = {
          tv_sec = 1411799860,
          tv_usec = 220479
        }
#7  0x00007fffe5209efd in skype_login_part2 (acct=0x555555e2dbd0, 
acct@entry=<error reading variable: value has been optimized out>) at 
libskype.c:1747
        reply = <optimized out>
        gc = 0x5555561765e0
        missedmessagestimout = 0
#8  0x00007ffff5378613 in g_timeout_dispatch (source=0x55555622f2b0, 
callback=<optimized out>, user_data=<optimized out>) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gmain.c:4520
        timeout_source = 0x55555622f2b0
        again = <optimized out>
#9  0x00007ffff5377b6d in g_main_dispatch (context=0x55555586ccf0) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gmain.c:3111
        dispatch = 0x7ffff5378600 <g_timeout_dispatch>
        prev_source = 0x0
        was_in_call = 0
        user_data = 0x555555e2dbd0
        callback = 0x7fffe5209eb0 <skype_login_part2>
        cb_funcs = <optimized out>
        cb_data = 0x5555561cc7d0
        need_destroy = <optimized out>
        source = 0x55555622f2b0
        current = 0x555556063fc0
        i = 12
#10 g_main_context_dispatch (context=context@entry=0x55555586ccf0) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gmain.c:3710
No locals.
#11 0x00007ffff5377f48 in g_main_context_iterate (context=0x55555586ccf0, 
block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gmain.c:3781
        max_priority = 0
        timeout = 0
        some_ready = 1
        nfds = <optimized out>
        allocated_nfds = 8
        fds = 0x555555d551e0
#12 0x00007ffff5378272 in g_main_loop_run (loop=0x5555561b9360) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gmain.c:3975
        __FUNCTION__ = "g_main_loop_run"
#13 0x00007ffff6615bc7 in gtk_main () from 
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
No symbol table info available.
#14 0x000055555558f0d1 in main (argc=1, argv=0x7fffffffe6c8) at 
/build/pidgin-lGhYHj/pidgin-2.10.9/./pidgin/gtkmain.c:933
        opt_help = -15680
        opt_version = 1439729824
        opt_config_dir_arg = 0x0
        accounts = 0x0
        sigset = {
          __val = {82950, 0 <repeats 15 times>}
        }
        errmsg = '\000' <repeats 760 times>...
        signal_channel = 0x0
        signal_status = G_IO_STATUS_ERROR
        error = 0x0
        opt = 0
        debug_enabled = 80
        active_accounts = 0x0
        st = {
          st_dev = 0,
          st_ino = 0,
          st_nlink = 0,
          st_mode = 0,
          st_uid = 0,
          st_gid = 0,
          __pad0 = 0,
          st_rdev = 0,
          st_size = 0,
          st_blksize = 0,
          st_blocks = 0,
          st_atim = {
            tv_sec = 0,
            tv_nsec = 0
          },
          st_mtim = {
            tv_sec = 0,
            tv_nsec = 0
          },
          st_ctim = {
            tv_sec = 0,
            tv_nsec = 0
          },
          __glibc_reserved = {0, 0, 0}
        }
        long_options = {{
            name = 0x55555562bb03 "config",
            has_arg = 1,
            flag = 0x0,
            val = 99
          }, {
            name = 0x55555561a139 "debug",
            has_arg = 0,
            flag = 0x0,
            val = 100
          }, {
            name = 0x555555627b24 "force-online",
            has_arg = 0,
            flag = 0x0,
            val = 102
          }, {
            name = 0x55555561bcba "help",
            has_arg = 0,
            flag = 0x0,
            val = 104
          }, {
            name = 0x5555556279ed "login",
            has_arg = 2,
            flag = 0x0,
            val = 108
          }, {
            name = 0x555555627b31 "multiple",
            has_arg = 0,
            flag = 0x0,
            val = 109
          }, {
            name = 0x555555627b3a "nologin",
            has_arg = 0,
            flag = 0x0,
            val = 110
          }, {
            name = 0x55555562bb16 "session",
            has_arg = 1,
            flag = 0x0,
            val = 115
          }, {
            name = 0x55555561e57a "version",
            has_arg = 0,
            flag = 0x0,
            val = 118
          }, {
            name = 0x55555562bb0c "display",
            has_arg = 1,
            flag = 0x0,
            val = 68
          }, {
            name = 0x5555556286d3 "sync",
            has_arg = 0,
            flag = 0x0,
            val = 83
          }, {
            name = 0x0,
            has_arg = 0,
            flag = 0x0,
            val = 0
          }}


I have the following threads running during the crash:

(gdb) thread
[Current thread is 1 (Thread 0x7ffff7f9e9c0 (LWP 28522))]
(gdb) info threads
  Id   Target Id         Frame
  3    Thread 0x7fffcbfff700 (LWP 28537) "pidgin" syscall () at 
../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  2    Thread 0x7fffd1092700 (LWP 28533) "pidgin" 0x00007ffff47e64ad in 
nanosleep () at ../sysdeps/unix/syscall-template.S:81
* 1    Thread 0x7ffff7f9e9c0 (LWP 28522) "pidgin" 0x00007ffff4764077 in 
__GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56

(gdb) thread 2
[Switching to thread 2 (Thread 0x7fffd1092700 (LWP 28533))]
#0  0x00007ffff47e64ad in nanosleep () at ../sysdeps/unix/syscall-template.S:81
81      ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) bt
#0  0x00007ffff47e64ad in nanosleep () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007ffff480e5b4 in usleep (useconds=useconds@entry=1000) at 
../sysdeps/unix/sysv/linux/usleep.c:32
#2  0x00007fffe520680d in receive_message_loop () at skype_messaging_x11.c:235
#3  0x00007ffff539e925 in g_thread_proxy (data=0x5555561bc720) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gthread.c:764
#4  0x00007ffff4adf0a4 in start_thread (arg=0x7fffd1092700) at 
pthread_create.c:309
#5  0x00007ffff4814c2d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

(gdb) bt
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007ffff53bc4cc in g_cond_wait (cond=cond@entry=0x5555561cc578, 
mutex=mutex@entry=0x5555561cc570) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gthread-posix.c:1396
#2  0x00007ffff534caab in g_async_queue_pop_intern_unlocked 
(queue=queue@entry=0x5555561cc570, wait=wait@entry=1, 
end_time=end_time@entry=-1) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gasyncqueue.c:419
#3  0x00007ffff534cf17 in g_async_queue_pop (queue=0x5555561cc570) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gasyncqueue.c:453
#4  0x00007fffe5205d7c in send_messages_thread_func (data=<optimized out>) at 
skype_messaging.c:139
#5  0x00007ffff539e925 in g_thread_proxy (data=0x5555561bc770) at 
/build/glib2.0-Dv_k6u/glib2.0-2.42.0/./glib/gthread.c:764
#6  0x00007ffff4adf0a4 in start_thread (arg=0x7fffcbfff700) at 
pthread_create.c:309
#7  0x00007ffff4814c2d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

The documentation of g_cond_timed_wait() says:

 * g_cond_timed_wait:
 * @cond: a #GCond
 * @mutex: a #GMutex that is currently locked
 * @abs_time: a #GTimeVal, determining the final time

But in the source code, the mutex is not locked. By locking the mutex,
the crash is fixed for me. Attached is the patch.

- -- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages pidgin-skype depends on:
ii  libpurple0           2.10.9-1+b1
ii  pidgin-skype-common  20130613+svn660+dfsg-1

pidgin-skype recommends no packages.

pidgin-skype suggests no packages.

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJUJmFvAAoJEJWkL+g1NSX55JQP/2/4ab4hxxhcJTD/KOjzzc9e
E8tWv2QiD520BvgLyd+eaA9XF1WRSX3OsowaqVlWbgu/Qtj6oDJt+Ji7Cqcg3A6w
gmBtwmISqpMUY5isTbqBFY8kcrHA54bG0AH3FNM64709ZXTQsu2nX5rQz+fScZXS
6m38LnwL+M/4urkIuER+j6+yAl3kcPsQxAgoyKV0KsoRFltTunWOr7P8E9o4wxAL
zO8vcS1yWagD0wTr1nZPIiq6rowJP1ULivWPgRaOGAcrVcVmyh5a3HZB2rckkIcM
uy6pjUB6WrhkJNtWRpYP006sXiKM3h4xtdclDv0a325YW8c+Hyf/IvPJdnl5ShFm
A/bKzqVPF2312iwvU3xUgLeBWVqJfCbqqG+iQkgUxO62vCFZBcRAbhMNFhWCBExi
mWPji9Gj/Du5LXNYeUkcDa1hxLi5s2Gz3Zj1D1DjX2UQP2Mq6VH6eRgBoMNZY4Mq
rkcLj24jSZ38XEDPihquG7HXwFTFqEbNmsfqVJdXMt6TkoW3140SWkbtfGG9aGBp
XnF2Ml3cSUF35w+2cvr0MqLkS9OL8W8jwTf/mCpTEFHX5cARj6mxECYLzuy22KHl
kW1+ZGynyAPIQQaELEeY7/7ZCBZbzxvAan9HCOt5752FQ9+iHgtqkXtk7tZI/QyA
D4MoHbsWr1+QQFwwlzFs
=queD
-----END PGP SIGNATURE-----
Index: pidgin-skype-20130613+svn660+dfsg/skype_messaging.c
===================================================================
--- pidgin-skype-20130613+svn660+dfsg.orig/skype_messaging.c
+++ pidgin-skype-20130613+svn660+dfsg/skype_messaging.c
@@ -232,11 +232,9 @@ char *skype_send_message(char *message_f
 		//wait for message for a maximum of 10 seconds
 		g_get_current_time(&endtime);
 		g_time_val_add(&endtime, 10 * G_USEC_PER_SEC);
+		g_static_mutex_lock2(&mutex);
 		condition_result = g_cond_timed_wait(condition, g_static_mutex_get_mutex2(&mutex), &endtime);
-		
-		//g_cond_timed_wait already locks this mutex
-		//g_static_mutex_lock2(&mutex);
-		
+
 		if(!condition_result)
 #endif
 #endif

Reply via email to