[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32452: 26.1; gnutls_try_handshake maxes out cpu retrying when server
From: |
Lars Ingebrigtsen |
Subject: |
bug#32452: 26.1; gnutls_try_handshake maxes out cpu retrying when server is a bit busy |
Date: |
Tue, 24 Sep 2019 07:39:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Noam Postavsky <npostavs@gmail.com> writes:
> + enum { MAX_DELAY_NS = 100 * 1000 * 1000 }; // Max 100ms delay.
> + struct timespec delay = { 0, 1000 };
> do
> {
> ret = gnutls_handshake (state);
> @@ -558,7 +560,9 @@ gnutls_try_handshake (struct Lisp_Process *proc)
> }
> while (ret < 0
> && gnutls_error_is_fatal (ret) == 0
> - && ! non_blocking);
> + && ! non_blocking
> + && (nanosleep (&delay, NULL),
> + delay.tv_nsec = min (delay.tv_nsec * 2, MAX_DELAY_NS)));
This code has changed somewhat since the proposed patch:
while ((ret = gnutls_handshake (state)) < 0)
{
do
ret = gnutls_handshake (state);
while (ret == GNUTLS_E_INTERRUPTED);
if (0 <= ret || emacs_gnutls_handle_error (state, ret) == 0
|| non_blocking)
break;
maybe_quit ();
}
But perhaps adding some sleep here would be a good idea, anyway. On the
other hand, 100ms seems way too long -- that's a noticeable slow-down in
network set-up.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#32452: 26.1; gnutls_try_handshake maxes out cpu retrying when server is a bit busy,
Lars Ingebrigtsen <=