Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-17615

WebClient .retrieve() + bodyToMono() causes "Only one connection receive subscriber allowed" on 4xx and 5xx

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Duplicate
    • Affects Version/s: 5.1.3
    • Fix Version/s: None
    • Component/s: Web
    • Labels:
    • Last commented by a User:
      true

      Description

      On 4xx and 5xx status, using WebClient "retrieve" + "bodyTo..." causes swallowed exception:

      java.lang.IllegalStateException: Only one connection receive subscriber allowed. 

      Example (kotlin):

      WebClient.builder().build().get()
              .uri("https://jira.atlassian.com/rest/api/latest/issue/QWERTY-123")
              .retrieve()
              .bodyToMono(String::class.java)
              .test()
              .expectError(WebClientResponseException::class.java)
              .verify()

       

      Probably exception handler subscribes to the connection itself so "bodyTo..." causes this exception. 

      Anyway, WebClientResponseException is being correctly thrown and IllegalStateException is just swallowed and printed to the output

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bclozel Brian Clozel
              Reporter:
              encircled Vladislav Kisel
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 23 weeks, 6 days ago