mirror of
https://github.com/apple/container.git
synced 2026-07-13 13:07:06 +00:00
e1e016b784
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.