ensure that HttpResponse entities are consumed or cancelled
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.4k
- Forks
- 584
- Avg merge
- 14h 33m
- Merged PRs (30d)
- 24
Description
**Issue by [rkuhn](https://github.com/rkuhn)**
_Monday Jan 25, 2016 at 08:09 GMT_
_Originally opened as https://github.com/akka/akka/issues/19602_
---
HTTP responses may often come from resources that need to be cleaned up, and in order to determine the HTTP response status code the resources will usually have been allocated already before the entity is materialized. This means that we must ensure that entities do not get dropped to the floor when the HTTP client closes the connection.
A solution sketch:
- we wrap Sources passing towards the network through akka.http.impl.engine.server.HttpServerBluePrint.ControllerStage such that we can track their materialization
- when the ControllerStage sees downstream termination it will try to cancel all previously wrapped Sources, failing silently for those that have already been materialized—this is sufficient because after materialization the TCP connection’s cancellation signal will propagate upstream to close the resource
/cc @jroper
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing akka.http.impl.engine.server.HttpServerBluePrint.ControllerStage and how HTTP client connection closure signals downstream termination. Check how Sources passed toward the network are materialized and cancelled. Done means previously wrapped, unmaterialized Sources are cancelled when the controller terminates, while already materialized resources are cleaned up through TCP cancellation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api, backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100