question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response,springboot2.1.6

See original GitHub issue

springboot2.1.6.RELEASE and Spring Cloud Greenwich.SR1

image

application.yml

spring: application: name: gateway-service cloud: gateway: default-filters: - StripPrefix=1 routes: - id: provider_api_route uri: lb://provider-service predicates: - Path=/web/** discovery: locator: enabled: true consul: enabled: true discovery: instanceId: ${spring.application.name}😒{vcap.application.instance_id:${spring.application.instance_id:${random.value}}} #prefer-ip-address: true retry: initial-interval: 10 multiplier: 1 max-interval: 30000 max-attempts: 15

my pom.xml

` <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.6.RELEASE</version> <relativePath/> </parent> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <name>demo</name> <description>Demo project for Spring Boot</description>

<properties>
    <java.version>1.8</java.version>
    <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-gateway</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-consul-discovery</artifactId>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
</project> `

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:24 (11 by maintainers)

github_iconTop GitHub Comments

8reactions
Ziemowitcommented, Apr 1, 2020

@creaton60 have you tried to set the maxIdleTime property?

spring:
    gateway:
      httpclient:
        pool:
          max-idle-time: <PUT_YOUR_VALUE_HERE>ms

AFAIR by default, it is NULL so your connection will be waiting forever without closing it on the gateway and it may be closed on server site.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connection prematurely closed BEFORE response on half ...
WebClientRequestException: Connection prematurely closed BEFORE response; nested exception is reactor.netty.http.client.
Read more >
PrematureCloseException: Connection prematurely closed
The problem seems to be that whenever you use webclient, you have to return or use the response, otherwise it will close the...
Read more >
How to Avoid Common Mistakes When Using ... - SlideShare
R:YYY] The connection observed an error reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response ...
Read more >
reactor.netty.http.client.PrematureCloseException: Connection ...
PrematureCloseException : Connection prematurely closed BEFORE response报错 ... The connection observed an error reactor.netty.http.client.
Read more >
spring boot java.sql.sqlrecoverableexception: closed connection
spring-cloud/spring-cloud-gatewayreactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response,springboot2.1.6#1148.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found