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

http-conduit: Requests may be retained in Responses #538

Open
JackKelly-Bellroy opened this issue Jul 5, 2024 · 0 comments · May be fixed by #540
Open

http-conduit: Requests may be retained in Responses #538

JackKelly-Bellroy opened this issue Jul 5, 2024 · 0 comments · May be fixed by #540

Comments

@JackKelly-Bellroy
Copy link
Contributor

A colleague (@kokobd) did a lot of digging into space leaks while using amazonka, and we've observed that large requests cause a noticeable space leak. This sounds similar to brendanhay/amazonka#475

When http-conduit constructs a response, it stores the original request in a record field and overwrites its body:

, responseOriginalRequest = req {requestBody = ""}

We suspect that this record update is never forced (there are no bang-patterns or other strictness tools that we can see), so the original request body cannot be garbage collected until execution leaves the ResourceT.

It might be necessary to add bang patterns to (at least) the responseOriginalRequest field of Response and the requestBody field of Request. It is probably safe for the fields of the RequestBody constructors to remain lazy.

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 a pull request may close this issue.

1 participant