spring-cloud / spring-cloud/spring-cloud-openfeign
HTTP connection leak when using feign.Response and apache HTTP client Connection pool
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 838
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 13
Description
Describe the bug
I would like to report the following behavior: when using feign.Response in @FeignClient with Transfer-Encoding: chunked response header, the HTTP connection is not getting released back to the HTTP connection pool causing HTTP connection leak.
You can find code samples which are reproducing the issue.
My setup is:
Java 21
Spring Boot 3.4.6
Sample
Sample client:
https://github.com/emilnkrastev/client-feign
Sample target:
https://github.com/emilnkrastev/target-feign
Sample DEBUG messages:
2025-05-27T14:46:57.087+03:00 DEBUG 15672 --- [client-feign] [nio-8081-exec-5] h.i.i.PoolingHttpClientConnectionManager : ex-0000000003 endpoint lease request (3 MINUTES) [route: {}->[http://localhost:8080]][total available: 0; route allocated: 2 of 50; total allocated: 2 of 200]
2025-05-27T14:46:57.087+03:00 DEBUG 15672 --- [client-feign] [nio-8081-exec-5] h.i.i.PoolingHttpClientConnectionManager : ex-0000000003 endpoint leased [route: {}->[http://localhost:8080]][total available: 0; route allocated: 3 of 50; total allocated: 3 of 200]
The HTTP connections are constantly growing without connection release messages
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 with the linked client-feign and target-feign reproduction projects and run the sample with a chunked response while observing the connection-pool DEBUG messages. Trace the response handling that follows the Feign client call; done means connections are released back to the pool instead of continually accumulating.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100