playframework / playframework/playframework

Implement timeout for keep-alive requests

Open
#1,119 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:feature
Dominant language
Scala
Stars
12.6k
Forks
4k
Avg merge
2d 3h
Merged PRs (30d)
29

Description

The approach here should be:

  • Use an AtomicInteger to track active requests in PlayDefaultUpstreamHandler, incrementing it for each new request, decrement it when the request is finished.
  • Whenever the timeout reaches 0, and the connection is still open, set the timeout
  • Any time a request is received, cancel the timeout
  • When the timeout is triggered, close the connection

Let's make this default to 5 minutes, setting to -1 disables the timeout.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating PlayDefaultUpstreamHandler and tracing how requests begin and finish, along with the existing keep-alive handling. Implement the described active-request tracking and configurable five-minute timeout, with -1 disabling it; done means idle open connections close after the timeout while active or newly received requests cancel it.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.