Skip to content
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

Fix resource leak for HttpClient-based backends on cancellation #2413

Merged
merged 14 commits into from
Jan 24, 2025

Conversation

adamw
Copy link
Member

@adamw adamw commented Jan 23, 2025

Closes #1987


override protected def ensureOnAbnormal[T](effect: Task[T])(finalizer: => Task[Unit]): Task[T] = effect.onExit {
exit =>
if (exit.isSuccess) ZIO.unit else finalizer.orDie
Copy link

@ioaoue ioaoue Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's correct to use .orDie here. I don't think users will expect that sending a request might result in a defect. Defects are often considered unrecoverable and propagate until some higher-level handler catches them, and in some cases can cause the entire application to crash. Maybe in this case it would be better to just ignore the error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a .resurrect later on, but yeah, maybe ignoring here is fine

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry, I somehow didn't notice the .resurrect call

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change it to a log :)

@adamw adamw merged commit 3a6b9f4 into master Jan 24, 2025
21 checks passed
@adamw adamw deleted the interruptions branch January 24, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReadException "too many concurrent streams"
2 participants