spring-cloud / spring-cloud/spring-cloud-gateway

Adding azure-core-http-netty causes timeouts/hang on consecutive multipart requests (after SB 3.5.3 → 3.5.4)

Open
#3,907 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feedback-provided
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

Description

Describe the bug

When com.azure:azure-core-http-netty dependency is added to the pom.xml, consecutive multipart requests through Spring Cloud Gateway Server MVC begin to time out and the gateway can eventually hang (no responses) until restarted.
This started right after upgrading Spring Boot from 3.5.3 to 3.5.4; removing the Azure Netty HTTP client dependency or downgrading back to 3.5.3 avoids the problem.
Also reproduced with Spring Boot 3.5.5.
Notes:
The project uses Spring Cloud Gateway Server MVC version 2025.0.0.

Expected behavior

Gateway should remain responsive and consistently proxy the request to the configured URI with no timeouts, regardless of azure-core-http-netty being on the classpath.

Actual behavior

First call often succeeds; subsequent calls begin to time out (e.g., curl --max-time 5 hits timeout).
After a few runs, the gateway can appear stuck and stops responding to new requests until the process is restarted.

Minimal Reproducer

A minimal Spring Boot + SCG Server MVC app that exposes a single route which forwards to itself (same port) and a simple (multipart) controller endpoint returning 400 quickly.

Steps to reproduce
  1. mvn -q spring-boot:run
  2. In a separate shell, run ./send.sh multiple times (or loop)
  3. With azure-core-http-netty dependency, subsequent calls begin to time out and the gateway can eventually hang.
  4. Remove the dependency (or revert SB to 3.5.3) and repeat — the issue disappears.
    (dont forget to reload maven when changing dependencies)
pom.xml
<project>
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.5.5</version>
  </parent>

  <groupId>com.example</groupId>
  <artifactId>cloudroute</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>cloudroute</name>
  <description>Demo project for Spring Cloud Routing</description>

  <properties>
    <java.version>21</java.version>
    <spring-cloud.version>2025.0.0</spring-cloud.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-gateway-server-webmvc</artifactId>
    </dependency>

    <!-- Adding this triggers the issue -->
    <dependency>
      <groupId>com.azure</groupId>
      <artifactId>azure-core-http-netty</artifactId>
      <version>1.16.0</version>
    </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>
application.yml
server:
  port: 8080
spring:
  application:
    name: cloudroute
  servlet:
    multipart:
      enabled: true
      max-file-size: 10MB
      max-request-size: 20MB
  cloud:
    gateway:
      server:
        webmvc:
          routes:
            - id: mutation-route
              uri: http://localhost:8080
              predicates:
                - Path=/application/v1/upload/mutation
              filters:
                - StripPrefix=1
Controller.java
package com.example.cloudroute;

import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@ResponseBody()
@RequestMapping(value = "/v1/upload", produces = {MediaType.TEXT_PLAIN_VALUE, MediaType.APPLICATION_JSON_VALUE})
public class Controller {
    @PostMapping(value = "/mutation", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public ResponseEntity<String> uploadMutation(final MultipartFile file) {
        System.out.println("Upload mutation file: " + file.getOriginalFilename());
        return ResponseEntity
                .status(400)
                .header("Content-Type", "text/plain")
                .body("Something happend here");
    }
}
send.sh
#!/bin/bash
FILE_PATH="src/main/resources/random_data_2_2mb.xlsx"
curl \
  --fail-with-body \
  -sS \
  --max-time 5 \
  -X POST \
  -H "Accept: application/json" \
  -F "file=@$FILE_PATH;type=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" \
  http://localhost:8080/application/v1/upload/mutation

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 with the pom.xml, application.yml, Controller.java, and send.sh in the minimal reproducer. Run mvn -q spring-boot:run and repeat ./send.sh with and without azure-core-http-netty, comparing Spring Boot 3.5.3 and 3.5.5. Done means consecutive multipart requests remain responsive without timeouts or a gateway hang.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, java, spring, spring-boot
Domain
api, backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.