Skip to content

Returning Mono.empty causes controller to halt #15214

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
bazusaladra opened this issue Nov 19, 2018 · 1 comment
Closed

Returning Mono.empty causes controller to halt #15214

bazusaladra opened this issue Nov 19, 2018 · 1 comment
Assignees
Labels
status: invalid An issue that we don't feel is valid

Comments

@bazusaladra
Copy link

bazusaladra commented Nov 19, 2018

The following code used to work on SpringBoot 2.0.2

    @GetMapping(path = "search")
    public Mono<String> search(@RequestParam(value = "query") String query) {
        if (Objects.isNull(query) || query.isEmpty()) {
            return Mono.empty();
        }
        return Mono.just("result: " + query);
    }

After upgrading to SpringBoot 2.1.0 calling

String actualEmptyResult = restTemplate.getForObject("/api/search?query=", String.class);

causes any subsequent requests to this endpoint to be stalled.
Please check out test org.springtest.EmptyMonoFailureTest#testMono in repository https://github.com/bazusaladra/spring-mono-test.
Please advice, to which module this issue may be related to.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 19, 2018
@bclozel bclozel self-assigned this Nov 19, 2018
@bclozel
Copy link
Member

bclozel commented Nov 19, 2018

When changing the server from reactor-netty to Tomcat, I can't reproduce the bug anymore:

compile('org.springframework.boot:spring-boot-starter-tomcat')

Also, updating to the latest 2.1.1.BUILD-SNAPSHOT

buildscript {

    ext {
        //springBootVersion = '2.0.2.RELEASE' // works
        springBootVersion = '2.1.1.BUILD-SNAPSHOT' // error
    }

    repositories {
        mavenCentral()
        maven {
          url "https://repo.spring.io/libs-snapshot"
        }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}


mainClassName = 'org.springtest.MonoTestApplication'

repositories {
    mavenCentral()
    maven {
      url "https://repo.spring.io/libs-snapshot"
    }
}

The issue seems to be resolved. I think it might be a reactor Netty issue, although I can't pinpoint exactly which one - they were several changes in that area recently.

I'm closing this issue as it doesn't seem to be a Spring Boot issue and it's been resolved already. In the meantime, you can use Tomcat as a server.

Thanks!

@bclozel bclozel closed this as completed Nov 19, 2018
@bclozel bclozel added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants