cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: SSL session sharing support added to curl_share_setopt()

From: Alejandro Álvarez Ayllón <alejandro.alvarez.ayllon_at_cern.ch>
Date: Thu, 10 Nov 2011 13:59:41 +0100

On 10/11/11 13:36, Daniel Stenberg wrote:
> On Thu, 10 Nov 2011, Leonid Yurchenko wrote:
>
>> I'm interested in this new feature, so I explored it a bit in the
>> current sources on the git. And I noticed that there is no sharing of
>> sessionage that each easy handle stores (not easy handle directly,
>> but UrlState that it owns). So each easy handle counts it's own
>> session age and in a result ages in a shared sessions pool may be
>> inconsistent, and removal of oldest may work incorrect.
>>
>> Is this a bug, or there is something I am missing about session ages
>> and it works correctly?
>
> Unfortunately this is what happens when we don't have test cases for a
> feature we add, and I was a bit weak and let this feature in before
> anyone contributed any tests. Now, I suspect nobody will provide any
> tests (since the feature is already there and writing tests is boring
> work) and we will instead rely on real-life tests by users... :-(
>
> But yes, it sounds like a bug. It'd help if you wrote up a sample code
> showing the problem or perhaps just wrote a patch that fixes it. As we
> haven't released any code with this feature, and the author of the
> feature didn't sound as if he's even using the git version of this
> feature, we don't really know if it works at all!
Hi,

It is possible (probable) that I missed some things. My use scenarios
are quite simple and they won't hit this issue. I have checked the code
and, indeed, there is a bug there. The general session age is
handle-specific, but the sessions are shared across multiple handles. My
bad.

I see two solutions:

   - Use a static counter. Locking would have to be unconditional even
when sessions are not shared. Probably not ideal.
   - Share a struct with the counter plus the array, instead of only the
array.

The second is nicer, but implies more changes, I think.

Sorry for the mistake.

Regards.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-11-10