Skip to content

fix FileDownloadDelegate #364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
weissi opened this issue May 11, 2021 · 0 comments · Fixed by #614
Closed

fix FileDownloadDelegate #364

weissi opened this issue May 11, 2021 · 0 comments · Fixed by #614
Labels
kind/bug Feature doesn't work as expected.

Comments

@weissi
Copy link
Contributor

weissi commented May 11, 2021

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

😭

@weissi weissi added the kind/bug Feature doesn't work as expected. label Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Feature doesn't work as expected.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant