Subject: bug#22789: 25.1.50; In last master build https connections stop working

From: Alain Schneble <[email-masked]>
Date: Mon, 7 Mar 2016 19:03:58 +0100

Eli Zaretskii <[email-masked]> writes:

>> From: Alain Schneble <[email-masked]>
>> CC: <[email-masked]>, <[email-masked]>, <[email-masked]>
>> Date: Mon, 7 Mar 2016 18:20:20 +0100
>> 
>> >>   Could it be a multi-threading issue then?  Multiple threads
>> >>   accessing the same socket...
>> >
>> > Not sure I follow -- are you trying to explain why ioctlsocket doesn't
>> > fail as expected, or are you trying to explain some other phenomenon?
>> 
>> Both.  1) I expected it to (sometime) fail but didn't see it.  2) The
>> arbitrary gnutls_handshake failures I observed seem like the socket's
>> state is getting corrupted.
>
> I cannot argue with facts.  I'm not sure the ioctlsocket calls are
> what causes the failures, but since you say the failures disappear
> when we don't, it's a fact that we should accept.

Neither do I.  Yes, the failures disappear completely.

>> Do you agree that WSAEventSelect is called from the reader thread and
>> the ioctlsocket is called from the main thread?
>
> Yes, of course.
>
>> And AFAIK, these functions are not thread safe...
>
> I don't think this is true.  AFAIK, the WSA* functions are all
> thread-safe.

Hm, it seems you are right, but I was not able to quickly find a *clear*
statement about this on MSDN...

>> So I suspect that we ran into a multi-threading issue here, which
>> corrupted the socket.  And may have lead to the above mentioned
>> issues.
>
> It's possible.  But if you see the problems solved after the change, I
> see no reason to continue arguing.

Yes, it solves the problems.  (Nevertheless, it would have been nice if
somebody else were able to reproduce the failures...)

Thanks.