From: Stefan Eissing Date: Wed, 11 Sep 2024 11:53:44 +0000 (+0200) Subject: QUIC: on connect, keep on trying on draining server X-Git-Tag: curl-8_10_1~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=283af039c819bd8039f8d7314f924079782d5abb;p=thirdparty%2Fcurl.git QUIC: on connect, keep on trying on draining server Do not give up connect on servers that are in draining state. This might indicate the QUIC server restarting and the UDP packet routing still hitting the instance shutting down. Instead keep on connecting until the overall TIMEOUT fires. Closes #14863 --- diff --git a/lib/connect.c b/lib/connect.c index b9da7c1621..20275163b5 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -547,9 +547,11 @@ static CURLcode baller_start_next(struct Curl_cfilter *cf, { if(cf->sockindex == FIRSTSOCKET) { baller_next_addr(baller); - /* If we get inconclusive answers from the server(s), we make - * a second iteration over the address list */ - if(!baller->addr && baller->inconclusive && !baller->rewinded) + /* If we get inconclusive answers from the server(s), we start + * again until this whole thing times out. This allows us to + * connect to servers that are gracefully restarting and the + * packet routing to the new instance has not happened yet (e.g. QUIC). */ + if(!baller->addr && baller->inconclusive) baller_rewind(baller); baller_start(cf, data, baller, timeoutms); } diff --git a/lib/vquic/curl_ngtcp2.c b/lib/vquic/curl_ngtcp2.c index b0a100eb66..3b958e2279 100644 --- a/lib/vquic/curl_ngtcp2.c +++ b/lib/vquic/curl_ngtcp2.c @@ -129,7 +129,6 @@ struct cf_ngtcp2_ctx { nghttp3_settings h3settings; struct curltime started_at; /* time the current attempt started */ struct curltime handshake_at; /* time connect handshake finished */ - struct curltime reconnect_at; /* time the next attempt should start */ struct bufc_pool stream_bufcp; /* chunk pool for streams */ struct dynbuf scratch; /* temp buffer for header construction */ struct Curl_hash streams; /* hash `data->mid` to `h3_stream_ctx` */ @@ -2311,12 +2310,6 @@ static CURLcode cf_ngtcp2_connect(struct Curl_cfilter *cf, CF_DATA_SAVE(save, cf, data); - if(ctx->reconnect_at.tv_sec && Curl_timediff(now, ctx->reconnect_at) < 0) { - /* Not time yet to attempt the next connect */ - CURL_TRC_CF(data, cf, "waiting for reconnect time"); - goto out; - } - if(!ctx->qconn) { ctx->started_at = now; result = cf_connect_start(cf, data, &pktx); diff --git a/lib/vquic/curl_osslq.c b/lib/vquic/curl_osslq.c index ffe3ca0c11..6121b2f893 100644 --- a/lib/vquic/curl_osslq.c +++ b/lib/vquic/curl_osslq.c @@ -288,7 +288,6 @@ struct cf_osslq_ctx { struct curltime started_at; /* time the current attempt started */ struct curltime handshake_at; /* time connect handshake finished */ struct curltime first_byte_at; /* when first byte was recvd */ - struct curltime reconnect_at; /* time the next attempt should start */ struct bufc_pool stream_bufcp; /* chunk pool for streams */ struct Curl_hash streams; /* hash `data->mid` to `h3_stream_ctx` */ size_t max_stream_window; /* max flow window for one stream */ @@ -1686,12 +1685,6 @@ static CURLcode cf_osslq_connect(struct Curl_cfilter *cf, now = Curl_now(); CF_DATA_SAVE(save, cf, data); - if(ctx->reconnect_at.tv_sec && Curl_timediff(now, ctx->reconnect_at) < 0) { - /* Not time yet to attempt the next connect */ - CURL_TRC_CF(data, cf, "waiting for reconnect time"); - goto out; - } - if(!ctx->tls.ossl.ssl) { ctx->started_at = now; result = cf_osslq_ctx_start(cf, data); diff --git a/lib/vquic/curl_quiche.c b/lib/vquic/curl_quiche.c index 9182fe9e47..768a5f2ae1 100644 --- a/lib/vquic/curl_quiche.c +++ b/lib/vquic/curl_quiche.c @@ -96,7 +96,6 @@ struct cf_quiche_ctx { uint8_t scid[QUICHE_MAX_CONN_ID_LEN]; struct curltime started_at; /* time the current attempt started */ struct curltime handshake_at; /* time connect handshake finished */ - struct curltime reconnect_at; /* time the next attempt should start */ struct bufc_pool stream_bufcp; /* chunk pool for streams */ struct Curl_hash streams; /* hash `data->mid` to `stream_ctx` */ curl_off_t data_recvd; @@ -1406,13 +1405,6 @@ static CURLcode cf_quiche_connect(struct Curl_cfilter *cf, *done = FALSE; vquic_ctx_update_time(&ctx->q); - if(ctx->reconnect_at.tv_sec && - Curl_timediff(ctx->q.last_op, ctx->reconnect_at) < 0) { - /* Not time yet to attempt the next connect */ - CURL_TRC_CF(data, cf, "waiting for reconnect time"); - goto out; - } - if(!ctx->qconn) { result = cf_quiche_ctx_open(cf, data); if(result) diff --git a/tests/http/test_03_goaway.py b/tests/http/test_03_goaway.py index cef5840847..26d57bbe32 100644 --- a/tests/http/test_03_goaway.py +++ b/tests/http/test_03_goaway.py @@ -36,7 +36,6 @@ from testenv import Env, CurlClient, ExecResult log = logging.getLogger(__name__) -@pytest.mark.skipif(condition=Env().ci_run, reason="not suitable for CI runs") class TestGoAway: @pytest.fixture(autouse=True, scope='class') @@ -83,8 +82,6 @@ class TestGoAway: proto = 'h3' if proto == 'h3' and env.curl_uses_lib('msh3'): pytest.skip("msh3 stalls here") - if proto == 'h3' and env.curl_uses_lib('quiche'): - pytest.skip("does not work in CI, but locally for some reason") if proto == 'h3' and env.curl_uses_ossl_quic(): pytest.skip('OpenSSL QUIC fails here') count = 3