https://github.com/danielfernandez/test-spring-boot-reactive-netty
Test Repository for apparent issue when accessing netty-served Spring Boot reactive web apps
https://github.com/danielfernandez/test-spring-boot-reactive-netty
Last synced: about 1 year ago
JSON representation
Test Repository for apparent issue when accessing netty-served Spring Boot reactive web apps
- Host: GitHub
- URL: https://github.com/danielfernandez/test-spring-boot-reactive-netty
- Owner: danielfernandez
- License: apache-2.0
- Created: 2016-07-31T14:59:51.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-24T21:44:26.000Z (over 9 years ago)
- Last Synced: 2025-01-30T19:49:05.796Z (over 1 year ago)
- Language: Shell
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# test-spring-boot-reactive-netty
This repository tests an appearing issue when using Netty to serve a Spring Boot-enabled *Reactive Web* application.
This application is very simple: it was created at [http://start.spring.io](http://start.spring.io) and the following
modification was made to its `pom.xml` in order to disable the Tomcat starter and use Netty instead:
```xml
org.springframework.boot.experimental
spring-boot-starter-web-reactive
org.springframework.boot
spring-boot-starter-tomcat
io.projectreactor.ipc
reactor-netty
```
The controller is very simple:
```java
@RestController
public class TestSpringBootReactiveNettyController {
@RequestMapping(value = "/")
public Mono root() {
return Mono.just(new SomeBean("Ola mundo", "Hola mundo"));
}
}
```
# How to replicate
Requirements: Java 8, Maven 3, git client, web browser (Chrome or Firefox). Tested on several Operating Systems:
Mac OS 10.11 El Capitan, Windows 10, Ubuntu 16.
* Clone this repository
* `cd` to the project's folder
* Start the app with `mvn -U clean compile spring-boot:run`
* Open browser and go to `http://localhost:8080` (it is important that `localhost` is used)
* If a small piece of JSON loads OK the first time, hit refresh several times until some of those *refreshes* stop responding at all
# Issue description
Environments in which this has been replicated:
* Chrome 52, Postman (Chrome-based), Firefox 49 and Safari 9.1.3 on **Mac OS X 10.11 El Capitan** (server + browsers, all local).
* Chrome 52 and Firefox 49 on **Windows 10** (server + browsers, all local).
Symptoms: only alternate requests have response: 1. Response, 2. No response, 3. Response, 4. No response…
By means of debugging it has been determined that Netty **does** receive an HTTP request in every case. But no HTTP
response is sent half of the times.
By means of network sniffing it has been determined that the HTTP request looks alright, and exactly the same
both when there is HTTP response and when there isn't. Example:
```
GET / HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
```
This **cannot be replicated using `curl`, `httpie` or `wget`**. Only browsers seem to show this behaviour (or
Postman, which works on the Chrome engine).
Also, this behaviour also happens when the application is configured to return HTML (actually this issue initially
appeared at the [Thymeleaf + Spring Reactive sandbox application](https://github.com/thymeleaf/thymeleafsandbox-springreactive)).
**IMPORTANT**: This issue, in the same systems and setups, **cannot be replicated when accessing the server using its IP (e.g. `192.168.0.20`)**. So this seems somehow related to the use of `localhost`.