spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

Request body loss

Open abelyliu opened this issue 5 years ago • 6 comments

Describe the bug this is similar to https://github.com/spring-cloud/spring-cloud-gateway/issues/1925

if request packet and rst packet at the same time to reach, gateway sometimes only forward headers, In my opinion, gateway needs to forward a complete request or not forward.

Sample code in https://github.com/abelyliu/spring-gateway-demo

  1. run gateway and backend module
  2. run client module
  3. backend has exception log

here is network packets on my machine

this is the above picture dump file 1.pcapng.gz this is all request dump file 2.pcapng.gz

Environment Reactor version(s) used: 1.0.9 spring boot 2.5.3 spring cloud gateway 3.0.3 JVM version (java -version): openjdk 8 OS and version (eg. uname -a): Darwin 1s-iMac.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64

abelyliu avatar Aug 11 '21 09:08 abelyliu

@abelyliu I modify your backend service,i found backend service can review request body.

@RestController
public class Index {

    @RequestMapping("/test")
    public String index(@RequestBody RequestBodyDto bodyDto) {
        System.out.println("hello");
        System.out.println(bodyDto);
        return "hello";
    }
}

class RequestBodyDto {
    private String name;
    private Integer age;
    private String secretIdentity;
    // getter/setter
}

ctlove0523 avatar Aug 12 '21 11:08 ctlove0523

I try this code and update it on the github, it only reduces the frequency of occurrence.

abelyliu avatar Aug 13 '21 06:08 abelyliu

Has this problem been solved at last? I have also encountered it

1528992118 avatar Jan 12 '23 11:01 1528992118

Is this still an issue with Spring Boot 3.2 and Cloud 2023.0? Sorry for the late reply.

spencergibb avatar Mar 13 '24 22:03 spencergibb

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-cloud-issues avatar Mar 20 '24 22:03 spring-cloud-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

spring-cloud-issues avatar Mar 27 '24 22:03 spring-cloud-issues