master
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 * SPDX-License-Identifier: curl
22 *
23 ***************************************************************************/
24/*
25 * See https://github.com/curl/curl/issues/3371
26 *
27 * This test case checks whether curl_multi_remove_handle() cancels
28 * asynchronous DNS resolvers without blocking where possible. Obviously, it
29 * only tests whichever resolver curl is actually built with.
30 */
32/* We are waiting a generous two seconds for the removal. This is as low as we
33 can go while still easily supporting SIGALRM timing for the non-threaded
34 blocking resolver. It does not matter that much because when the test
35 passes, we never wait this long. We set it much higher via the default
36 TEST_HANG_TIMEOUT to avoid issues when running on overloaded CI machines. */
38#include "first.h"
40static CURLcode test_lib1592(const char *URL)
41{
42 int stillRunning;
43 CURLM *multi = NULL;
44 CURL *curl = NULL;
45 CURLcode result = CURLE_OK;
46 CURLMcode mresult;
47 long timeout;
49 global_init(CURL_GLOBAL_ALL);
51 multi_init(multi);
53 easy_init(curl);
55 easy_setopt(curl, CURLOPT_VERBOSE, 1L);
56 easy_setopt(curl, CURLOPT_URL, URL);
58 /* Set a DNS server that hopefully does not respond when using c-ares. */
59 if(curl_easy_setopt(curl, CURLOPT_DNS_SERVERS, "0.0.0.0") == CURLE_OK)
60 /* Since we could set the DNS server, presume we are working with a
61 resolver that can be cancelled (i.e. c-ares). Thus,
62 curl_multi_remove_handle() should not block even when the resolver
63 request is outstanding. Thus, set a request timeout _longer_ than the
64 test hang timeout so we fail if the handle removal call incorrectly
65 blocks. */
66 timeout = TEST_HANG_TIMEOUT * 2;
67 else {
68 /* If we cannot set the DNS server, presume that we are configured to use
69 a resolver that cannot be cancelled (i.e. the threaded resolver or the
70 non-threaded blocking resolver). Thus, we test that the
71 curl_multi_remove_handle() call does finish well within our test
72 timeout.
74 But, it is unlikely that the resolver request takes any time at
75 all because we have not been able to configure the resolver to use an
76 non-responsive DNS server. At least we exercise the flow. */
77 curl_mfprintf(stderr,
78 "CURLOPT_DNS_SERVERS not supported; "
79 "assuming curl_multi_remove_handle() does block\n");
80 timeout = TEST_HANG_TIMEOUT / 2;
81 }
83 /* Setting a timeout on the request should ensure that even if we have to
84 wait for the resolver during curl_multi_remove_handle(), it does not take
85 longer than this, because the resolver request inherits its timeout from
86 this. */
87 easy_setopt(curl, CURLOPT_TIMEOUT_MS, timeout);
89 multi_add_handle(multi, curl);
91 /* This should move the handle from INIT => CONNECT => WAITRESOLVE. */
92 curl_mfprintf(stderr, "curl_multi_perform()...\n");
93 multi_perform(multi, &stillRunning);
94 curl_mfprintf(stderr, "curl_multi_perform() succeeded\n");
96 /* Start measuring how long it takes to remove the handle. */
97 curl_mfprintf(stderr, "curl_multi_remove_handle()...\n");
98 start_test_timing();
99 mresult = curl_multi_remove_handle(multi, curl);
100 if(mresult) {
101 curl_mfprintf(stderr, "curl_multi_remove_handle() failed, with code %d\n",
102 mresult);
103 result = TEST_ERR_MULTI;
104 goto test_cleanup;
105 }
106 curl_mfprintf(stderr, "curl_multi_remove_handle() succeeded\n");
108 /* Fail the test if it took too long to remove. This happens after the fact,
109 and says "it seems that it would have run forever", which is not true, but
110 it is close enough, and simple to do. */
111 abort_on_test_timeout();
113test_cleanup:
114 curl_easy_cleanup(curl);
115 curl_multi_cleanup(multi);
116 curl_global_cleanup();
118 return result;
119}
Diagnostics4 git calls · 419 ms
CallStatusSizeTime0419 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2002.0 KiB413 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=413 git.response.bytes=2025 git.response.cache=MISS git.response.duration_ms=413 git.fetch.wants=497659b10062139553fc2c296b1cea893c875353 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=2025 git.pkt.payload.max=2004 git.sideband.band1.bytes=2003 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e331d73c4318aa
- Request
- a720b816…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format