title: Connection reset by peer io.netty.channel.unix.Errors$NativeIoException
body: <p>I am using WebClient from spring-boot-starter-webflux. I am consistently seeing Connection reset by peer error from reactor netty in production environment. Then reactor netty retries this failed request after few seconds (~10-20 seconds). I am not seeing or unable to reproducible this error in a lower environment. I am unable to identify the root cause of this error, here I provided my ClientHelper implementation and logs of the errors,</p>
  
  <pre><code>import com.fasterxml.jackson.core.type.TypeReference;
  import com.fasterxml.jackson.databind.ObjectMapper;
  import org.springframework.http.HttpStatus;
  import org.springframework.web.reactive.function.BodyInserters;
  import org.springframework.web.reactive.function.client.ClientResponse;
  import org.springframework.web.reactive.function.client.WebClient;
  
  public class ClientHelper {
  
    protected WebClient webClient;
  
    public &lt;T&gt; T post(Object request, TypeReference typeReference,
                      String uri) {
      try {
        ObjectMapper objectMapper = new ObjectMapper();
        String body = objectMapper.writeValueAsString(request);
        ClientResponse clientResponse =
                getWebClient()
                        .post()
                        .uri(uri)
                        .body(BodyInserters.fromObject(body))
                        .exchange()
                        .block();
        return prepareResponse(clientResponse, typeReference, objectMapper);
      } catch (Exception e) {
        return handleException(e);
      }
    }
  
    protected &lt;T&gt; T prepareResponse(ClientResponse clientResponse, TypeReference typeReference,
                                    ObjectMapper objectMapper) throws Exception {
      String responseText = clientResponse.bodyToMono(String.class).block();
      if (clientResponse.statusCode() == HttpStatus.OK) {
        return objectMapper.readValue(responseText, typeReference);
      } else {
        throwNewException("Remote service returned a message with statusCode = "
                + clientResponse.statusCode() + "; response = " + responseText,  null);
        return null;
      }
    }
  
    protected &lt;T&gt; T handleException(Exception e) {
      throwNewException("Communication error. Cause: " + e.getMessage(), e);
      return null;
    }
  
    protected void throwNewException(String message, Throwable cause) {
      throw new RuntimeException(message, cause);
    }
  
    public WebClient getWebClient() {
      return WebClient.builder().baseUrl("http://app.corp.com/").build();
    }
  </code></pre>
  
  <pre><code>2019-10-29 20:56:20,383 DEBUG r.u.Loggers$Slf4JLogger [reactor-http-epoll-8] [] [id: 0x65cf7989, L:/xx.xx.xxx.xxx:xxxxx - R:app.corp.com/xx.xx.xx.xx:xxx] The connection observed an error, the request will be retried
  io.netty.channel.unix.Errors$NativeIoException: readAddress(..) failed: Connection reset by peer
  </code></pre>
  
  <blockquote>
    <p>spring-boot-starter-webflux: 2.1.9.RELEASE,
    reactor-netty: 0.8.12.RELEASE</p>
  </blockquote>
  
  <p>Please let me know if there is an issue with this implementation and/or how to triage this issue further.</p>