Skip to content

Spring Web Reactive + Netty hangs on Windows when sending JSON [SPR-15108] #19675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Jan 7, 2017 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket)

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jan 7, 2017

Daniel Fernández opened SPR-15108 and commented

Scenario

A web application developed using Spring Boot 2.0 (snapshot) and Spring 5 Web Reactive using Netty as a server, outputs an amount of data in JSON format.

Implementation

The test-boot-netty-windows repository (tag spr15108) contains a test application initialised using http://start.spring.io.

It uses Spring Boot 2.0 and Spring 5 Web Reactive. The dependencies have been modified in order to use Netty as a server instead of Apache Tomcat.

The application contains a @RestController which has a controller method returning a Flux<Entity>.

The sample application can be started with mvn -U clean compile spring-boot:run, and it can be called like curl http://localhost:8080/list/SIZE, being SIZE the size of the list of elements to be returned.

Observed results

When running this application on Windows 10, if we request 41 elements everything goes alright, because the output size is 1969 bytes (less than 2 KBytes):

$ curl http://localhost:8080/list/41 > out
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1969    0  1969    0     0  63516      0 --:--:-- --:--:-- --:--:--  128k

...but if we request 50 elements:

$ curl http://localhost:8080/list/50 > out1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2017    0  2017    0     0     13      0 --:--:--  0:02:28 --:--:--     0
^C (Interrupted)

Apparently, the server hangs when it needs to flush output data that exceeds 2048 bytes.

I've tested this on two different Windows 10 machines with the same result. Also, I've tested that this works OK on both MacOS 10.10 and Linux Ubuntu 16.

Note that, given this seems to involve the Netty output buffers, it might be related to #19662


Affects: 5.0 M4

Reference URL: https://github.com/danielfernandez/test-boot-netty-windows/tree/spr15108

@spring-projects-issues
Copy link
Collaborator Author

Brian Clozel commented

Hi Daniel Fernández,

Indeed, there were a few identified reactor netty issues related to buffering and flushing of the response body; so I've waited for those to be resolved and checked again: everything works out now (tested on windows 7 against the latest Spring Boot SNAPSHOTs).

Thanks for raising this issue and sorry for the late reply!

@spring-projects-issues spring-projects-issues added type: bug A general bug in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug A general bug label Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket)
Projects
None yet
Development

No branches or pull requests

2 participants