spring-cloud / spring-cloud/spring-cloud-gateway
Spring cloud gateway - Connection prematurely closed DURING response
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
I am using Spring cloud gateway with eureka regisry and using open feign client to communicate between 2 services .
Cloud gateway is working fine with normal API's. It is throwing below error while running a Spring batch application:
reactor.netty.http.client.PrematureCloseException: Connection prematurely closed DURING response
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
*__checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ HTTP POST "" [ExceptionHandlingWebHandler]
Original Stack Trace:
The error comes whenever it reaches a count 100000 records of ingestion (around 30 secs). Ingestion is happening through chunk and i have total 7.9 million records to be ingested.
Setting the configuration as below:
spring:
application:
name: *****
cloud:
openfeign:
httpclient:
connection-timeout: 10000000
client:
config:
default:
connectTimeout: 10800000
readTimeout: 50000000
When debug, i am getting the error because one of microservices called through Openfigen client is closing the connection as below:
DEBUG [http-nio-8051-exec-9] c.s.i.g.client.feign.ESFeignClient - [] connection: close
the routing service is having below response entity with response 200
INFO [http-nio-8051-exec-7] - response <200 OK OK,com.scb.icore.gbingestion.dto.ApiResponse@98f78b1,[connection:"close", content-type:"application/json;charset=UTF-8", date:"Wed, 26 Jun 2024 05:05:33 GMT", transfer-encoding:"chunked", vary:"Access-Control-Request-Headers", "Access-Control-Request-Method", "Origin"]>
Please help on this.
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 reproducing the Spring Cloud Gateway request through Eureka and OpenFeign with the Spring Batch workload, using the reported timeouts and chunk size that reaches about 100,000 records. Inspect the Reactor Netty PrematureCloseException and the routing service's HTTP 200 response with connection close; done means identifying the component that closes the connection and verifying the cause against the reported workload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100