bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#40665: 28.0.50; tls hang on local ssl


From: Derek Zhou
Subject: bug#40665: 28.0.50; tls hang on local ssl
Date: Wed, 22 Apr 2020 15:16:12 +0000 (UTC)
User-agent: mu4e 1.2.0; emacs 27.0.91

Robert Pluim writes:

>     Derek> I don't quite understand the wait_proc business. The idea of the 
> patch
>     Derek> is to detect that out of all the fds that are going to be 
> selected, how
>     Derek> many are gnutls managed and are ready from the gnutls buffer? If 
> the
>     Derek> answer is positive, we skip the select and pretend the select 
> return
>     Derek> those fds only. I think this is safe; because it is one of the 
> possible
>     Derek> and legal return of the select, wait_proc or not.
>
> The reason for checking wait_proc is to allow 'accept-process-output'
> to specify that emacs should return only when there is data for that
> specific process, with your patch it can return if there is any data
> in the TLS buffers for any connection, but none for wait_proc. That
> would make 'accept-process-output' return earlier than expected, or
> even return for the case where the timeout is infinite.
>
> A quick survey of the emacs sources shows almost every call to
> 'accept-process-output' passes in wait_proc, so I think that your
> change as it stands is too risky. With a check for wait_proc it might
> be OK.
>
My counter argument is if we really only care about some of the the fds
but not all the fds, the proper way is to let select know by passing in
the proper narrower set of fds, maybe the code is already this way? It is very
complicated so I am not sure. I am checking only those fds that are both
1, gnutls managed, and the 2 set in the input for readfds for the
select, so I believe it is the right thing.

>     Derek> Another way is to still do a zero timeout select, and merge the 
> gnutls
>     Derek> ready set with the select ready set. It is more intrusive but 
> probably
>     Derek> closer to the original intent of the code. I can write the path 
> that way
>     Derek> if you want.
>
> I donʼt think we always do a zero timeout select. This sounds even
> riskier.

I am proposing doing a zero timeout select ONLY if the gnutls buffer
check already flags some of the channels. This way we can also select those
FDs that are not gnutls managed, but already ready to read at the same
moment. It is closer to the origin intention of the select, I
believe. If the gnutls buffer check does not flag anything of cause we do
the select with timeout exactly as before. My current patch may leave
out some ready fd unchecked until the next round.

Derek





reply via email to

[Prev in Thread] Current Thread [Next in Thread]