cURL / Mailing Lists / curl-library / Single Mail

curl-library

Curl_share_lock deadlock when flushing cookielist?

From: Kristoffer Gleditsch <toffer_at_ping.uio.no>
Date: Wed, 19 Feb 2014 12:35:24 +0100

Hi!

I've been testing the share objects (CURLSH) for cookie sharing
between handles lately, but I've stumbled across a deadlock, so I'm
wondering if this is a bug, or if I'm just using it incorrectly:

We flush the cookie list:
curl_easy_setopt(request, CURLOPT_COOKIELIST, "FLUSH");

When executing this, Curl_setopt() does a share_lock on the cookie
data (https://github.com/bagder/curl/blob/master/lib/url.c#L1145).
Then it calls Curl_flush_cookies(), and that does another share_lock
on the cookie data
(https://github.com/bagder/curl/blob/master/lib/cookie.c#L1320), which
then makes pthreads fall over.

Is this intentional, i.e. are the lock function given to the share
handle required to be recursive? The documentation I've found don't
seem to say so, but I may not have looked in the right places.

(Granted, the FLUSH option seems to be a NOP when using the share
object instead of a cookie file, so the quick solution for us is to
just remove the call.)

Thanks,
Kristoffer
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-02-19