GNOME Bugzilla – Bug 688751
Deadlock in gnutls
Last modified: 2016-07-12 15:44:58 UTC
Recently I've started seeing deadlocks in liferea, and I tracked them down to glib-networking (through soup and webkit). The blocking call is the g_poll() for the cancellables in claim_op(CLOSING), which can't be satisfied because no gnutls thread is running. reading, read_blocking, writing, write_blocking flags are all 1. handshaking is also 1, but ever_handshaked is 1 and need_handshake is 0 A reduced backtrace follows:
+ Trace 231201
Thread 1 (Thread 0x7f71846c69c0 (LWP 28275))
The other threads are webkit GCs, glib, dconf, gdbus, webkit icondb, plus a GThreadPool waiting for more stuff. I suspected a race condition in the way the GWakeup is set up for the waiting_for_op GCancellable, so tried to move that inside the mutex, but it didn't help.
Can you try inserting a g_cancellable_cancel (gnutls->priv->waiting_for_op); after the gnutls->priv->handshaking = FALSE; in the need_finish_handshaking condition in claim_op? (ie, roughly line 551)
Nope, still the same deadlock.
I think stefw may have fixed this in glib-networking master: http://git.gnome.org/browse/glib-networking/commit/?id=58fd3d53
It is still hanging for me with the following backtrace:
+ Trace 231260
Here is a test case: http://rishi.fedorapeople.org/gtls-cancel.tar.gz Hangs on every 2nd attempt on my system.
Fixed in master. I think I might put out another stable release for this, after its gotten a little bit of testing.
*** Bug 693320 has been marked as a duplicate of this bug. ***