Commit e1e016b
authored
Fix HTTPClient crash when download fails before shutdown (#837)
Currently, when `FileDownloader.downloadFile()` encounters an error
during `client.execute()` (e.g., XPC connection interruption or network
timeout), the `HTTPClient` instance is deallocated without calling
`shutdown()`, resulting in a crash:
`AsyncHTTPClient/HTTPClient.swift:187: Fatal error: Client not shut down
before the deinit.`
This caused to a control flow issue when attempting to download the
default kernel during `container system start` and, under certain
conditions (e.g., network latency), encountering the timeout error
`HTTPClientError.connectTimeout`.
To address this, `client.execute()` is now wrapped in a do/catch to
ensure `shutdown()` is always called on both success and error paths.
Also I've added an explicit timeout configuration (30s connect, no read
timeout) to better accommodate large file downloads.1 parent cd7c3a1 commit e1e016b
1 file changed
+12
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
59 | 70 | | |
60 | 71 | | |
61 | 72 | | |
| |||
0 commit comments