title: Micronaut ReadTimeoutException
body: <p>I have a Grails 4 application providing a REST API. One of the endpoints sometimes fail with the following exception:</p>
  
  <pre><code>io.micronaut.http.client.exceptions.ReadTimeoutException: Read Timeout
      at io.micronaut.http.client.exceptions.ReadTimeoutException.&lt;clinit&gt;(ReadTimeoutException.java:26)
      at io.micronaut.http.client.DefaultHttpClient$10.exceptionCaught(DefaultHttpClient.java:1917)
      at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:297)
      at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:276)
      at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:268)
      at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireExceptionCaught(CombinedChannelDuplexHandler.java:426)
      at io.netty.channel.ChannelHandlerAdapter.exceptionCaught(ChannelHandlerAdapter.java:92)
      at io.netty.channel.CombinedChannelDuplexHandler$1.fireExceptionCaught(CombinedChannelDuplexHandler.java:147)
      at io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught(ChannelInboundHandlerAdapter.java:143)
      at io.netty.channel.CombinedChannelDuplexHandler.exceptionCaught(CombinedChannelDuplexHandler.java:233)
      at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:297)
      at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:276)
      at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:268)
      at io.netty.handler.timeout.ReadTimeoutHandler.readTimedOut(ReadTimeoutHandler.java:98)
      at io.netty.handler.timeout.ReadTimeoutHandler.channelIdle(ReadTimeoutHandler.java:90)
      at io.netty.handler.timeout.IdleStateHandler$ReaderIdleTimeoutTask.run(IdleStateHandler.java:505)
      at io.netty.handler.timeout.IdleStateHandler$AbstractIdleTask.run(IdleStateHandler.java:477)
      at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38)
      at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:127)
      at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
      at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:405)
      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
      at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
      at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
      at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
      at java.base/java.lang.Thread.run(Thread.java:834)
  </code></pre>
  
  <p>The endpoint uses micronaut http client to call other systems. The remote system takes a very long time to respond, causing the ReadTimeOutException.</p>
  
  <p>Here is the code calling the remote Service:</p>
  
  <pre><code>class RemoteTaskService implements GrailsConfigurationAware {
  
      String taskStepperUrl
  
      // initializes fields from configuration
      void setConfiguration(Config config) {
          taskStepperUrl = config.getProperty('services.stepper')
      }
  
      private BlockingHttpClient getTaskClient() {
          HttpClient.create(taskStepperUrl.toURL()).toBlocking()
      }
  
      List&lt;Map&gt; loadTasksByProject(long projectId) {
          try {
              retrieveRemoteList("/api/tasks?projectId=${projectId}")
          } catch(HttpClientResponseException e) {
              log.error("Loading tasks of project failed with status: ${e.status.code}: ${e.message}")
              throw new NotFoundException("No tasks found for project ${projectId}")
          }
      }
  
      private List&lt;Map&gt; retrieveRemoteList(String path) {
          HttpRequest request = HttpRequest.GET(path)
          HttpResponse&lt;List&gt; response = taskClient.exchange(request, List) as HttpResponse&lt;List&gt;
          response.body()
      }
  }
  </code></pre>
  
  <p>I've tried resolving it using the following configuration in my application.yml:</p>
  
  <pre><code>micronaut:
      server:
          read-timeout: 30
  </code></pre>
  
  <p>and</p>
  
  <pre><code>micronaut.http.client.read-timeout: 30
  </code></pre>
  
  <p>...with no success. Despite my configuration, the timeout still occurs around 10s after calling the endpoint.</p>
  
  <p>How can I change the read timeout duration for the http rest client?</p>