Closed
Description
FileDownloadDelegate
calls pool.start()
on a NIOThreadPool
that is either provided by the user or by AHC itself through
public init(
path: String,
pool: NIOThreadPool = NIOThreadPool(numberOfThreads: 1),
reportHead: ((HTTPResponseHead) -> Void)? = nil,
reportProgress: ((Progress) -> Void)? = nil
)
AHC however never calls .shutdownGracefully
/.syncShutdownGracefully
on that pool. That means the user has to provide a NIOThreadPool
, or else we'll just leak it (because AHC never calls stop).
Ie. in the default use case we
- spawn a fresh thread per download
- and then leak the thread
😭