Skip to content

Commit

Permalink
fix(http-storage): Disable broken connection keep-alive
Browse files Browse the repository at this point in the history
After ignoring SIGPIPE (b2a88e7) keep-alive support has been
re-enabled for HTTP Storage. Unfortunately it's still broken
but does not crash ccache, anymore.

This is the tcpdump of a (cache miss) compilation that takes longer
than the server keep-alive timeout:

```
10:51:17.214678 IP 10.34.129.62.37468 > 10.34.132.45.webcache: Flags [S], seq 1018344313, win 62727, options [mss 8961,sackOK,TS val 1638189791 ecr 0,nop,wscale 7], length 0
10:51:17.216386 IP 10.34.132.45.webcache > 10.34.129.62.37468: Flags [S.], seq 2695216843, ack 1018344314, win 26847, options [mss 8645,sackOK,TS val 1598789083 ecr 1638189791,nop,wscale 9], length 0
10:51:17.216424 IP 10.34.129.62.37468 > 10.34.132.45.webcache: Flags [.], ack 1, win 491, options [nop,nop,TS val 1638189793 ecr 1598789083], length 0
10:51:17.216534 IP 10.34.129.62.37468 > 10.34.132.45.webcache: Flags [P.], seq 1:143, ack 1, win 491, options [nop,nop,TS val 1638189793 ecr 1598789083], length 142: HTTP: GET /cache/ff87vlgke3poou7uq1ma2m3hh000gckmq HTTP/1.1
10:51:17.217393 IP 10.34.132.45.webcache > 10.34.129.62.37468: Flags [.], ack 143, win 55, options [nop,nop,TS val 1598789084 ecr 1638189793], length 0
10:51:17.217433 IP 10.34.132.45.webcache > 10.34.129.62.37468: Flags [P.], seq 1:309, ack 143, win 55, options [nop,nop,TS val 1598789085 ecr 1638189793], length 308: HTTP: HTTP/1.1 404 Not Found
10:51:17.217456 IP 10.34.129.62.37468 > 10.34.132.45.webcache: Flags [.], ack 309, win 489, options [nop,nop,TS val 1638189794 ecr 1598789085], length 0
10:51:17.538819 IP 10.34.129.62.37468 > 10.34.132.45.webcache: Flags [P.], seq 143:285, ack 309, win 489, options [nop,nop,TS val 1638190115 ecr 1598789085], length 142: HTTP: GET /cache/135di89r02vv5fgopbtsopfjllo01b8lg HTTP/1.1
10:51:17.539838 IP 10.34.132.45.webcache > 10.34.129.62.37468: Flags [P.], seq 309:617, ack 285, win 57, options [nop,nop,TS val 1598789407 ecr 1638190115], length 308: HTTP: HTTP/1.1 404 Not Found
10:51:17.539876 IP 10.34.129.62.37468 > 10.34.132.45.webcache: Flags [.], ack 617, win 487, options [nop,nop,TS val 1638190117 ecr 1598789407], length 0

10:52:32.536322 IP 10.34.132.45.webcache > 10.34.129.62.37468: Flags [F.], seq 617, ack 285, win 57, options [nop,nop,TS val 1598864404 ecr 1638190117], length 0
10:52:32.577893 IP 10.34.129.62.37468 > 10.34.132.45.webcache: Flags [.], ack 618, win 487, options [nop,nop,TS val 1638265155 ecr 1598864404], length 0

10:52:42.173135 IP 10.34.129.62.37468 > 10.34.132.45.webcache: Flags [P.], seq 285:492, ack 618, win 487, options [nop,nop,TS val 1638274750 ecr 1598864404], length 207: HTTP: PUT /cache/135di89r02vv5fgopbtsopfjllo01b8lg HTTP/1.1
10:52:42.173153 IP 10.34.129.62.37468 > 10.34.132.45.webcache: Flags [.], seq 492:9125, ack 618, win 487, options [nop,nop,TS val 1638274750 ecr 1598864404], length 8633: HTTP
10:52:42.173159 IP 10.34.129.62.37468 > 10.34.132.45.webcache: Flags [P.], seq 9125:17758, ack 618, win 487, options [nop,nop,TS val 1638274750 ecr 1598864404], length 8633: HTTP
10:52:42.173165 IP 10.34.129.62.37468 > 10.34.132.45.webcache: Flags [.], seq 17758:26391, ack 618, win 487, options [nop,nop,TS val 1638274750 ecr 1598864404], length 8633: HTTP
10:52:42.174049 IP 10.34.132.45.webcache > 10.34.129.62.37468: Flags [R], seq 2695217461, win 0, length 0
10:52:42.174056 IP 10.34.132.45.webcache > 10.34.129.62.37468: Flags [R], seq 2695217461, win 0, length 0
10:52:42.174057 IP 10.34.132.45.webcache > 10.34.129.62.37468: Flags [R], seq 2695217461, win 0, length 0
```

The PUT error due to the closed socket is also logged:
```
[2021-09-14T10:52:42.068112 2089 ] Storing result file modules/asyncly/Test/Unit/CMakeFiles/test_asyncly.dir/future/FutureTest.cpp.o
[2021-09-14T10:52:42.068118 2089 ] Storing embedded file #0 .o (36847216 bytes) from modules/asyncly/Test/Unit/CMakeFiles/test_asyncly.dir/future/FutureTest.cpp.o
[2021-09-14T10:52:42.154930 2089 ] Storing result file modules/asyncly/Test/Unit/CMakeFiles/test_asyncly.dir/future/FutureTest.cpp.o.d
[2021-09-14T10:52:42.154951 2089 ] Storing embedded file ccache#1 .d (122626 bytes) from modules/asyncly/Test/Unit/CMakeFiles/test_asyncly.dir/future/FutureTest.cpp.o.d
[2021-09-14T10:52:42.155260 2089 ] Stored 135di89r02vv5fgopbtsopfjllo01b8lg in primary storage (/cache/ccache/1/3/5di89r02vv5fgopbtsopfjllo01b8lgR)
[2021-09-14T10:52:42.175445 2089 ] Failed to put /cache/135di89r02vv5fgopbtsopfjllo01b8lg to http storage: Unknown (1)
[2021-09-14T10:52:42.175999 2089 ] Adding result key to /cache/ccache/f/f/87vlgke3poou7uq1ma2m3hh000gckmqM
[2021-09-14T10:52:42.179375 2089 ] Using default compression level 1
[2021-09-14T10:52:42.180306 2089 ] Stored ff87vlgke3poou7uq1ma2m3hh000gckmq in primary storage (/cache/ccache/f/f/87vlgke3poou7uq1ma2m3hh000gckmqM)
[2021-09-14T10:52:42.180341 2089 ] Not putting in http://jenkins3-bazelcache.ec2.getgotools.net:8080/cache since it failed earlier
```

I believe a 90s compilation is worth caching and more important than
skipping the TCP three-way handshake.
  • Loading branch information
gjasny committed Oct 1, 2021
1 parent 0d1773a commit fc5f6d2
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/storage/secondary/HttpStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ HttpStorageBackend::HttpStorageBackend(const Params& params)
m_http_client.set_default_headers({
{"User-Agent", FMT("{}/{}", CCACHE_NAME, CCACHE_VERSION)},
});
m_http_client.set_keep_alive(true);

auto connect_timeout = k_default_connect_timeout;
auto operation_timeout = k_default_operation_timeout;
Expand Down

0 comments on commit fc5f6d2

Please sign in to comment.