Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-12413

IllegalStateException when bad metrics scope requested

XMLWordPrintable

    • Hide
      1. Build WildFly from master branch with commit 0e13252d9e7a6c82e6e170bac1a2faf727287c1d
      2. Start server ./bin/standalone.sh
      3. perform request 'curl http://localhost:9990/metrics/test'
      4. see exception in server.log
      Show
      Build WildFly from master branch with commit 0e13252d9e7a6c82e6e170bac1a2faf727287c1d Start server ./bin/standalone.sh perform request 'curl http://localhost:9990/metrics/test ' see exception in server.log

      With WildFly build from master branch (commit 0e13252d9e7a6c82e6e170bac1a2faf727287c1d), I can see following exception in log:

      16:38:57,964 ERROR [io.undertow.request] (management I/O-1) UT005071: Undertow request failed HttpServerExchange{ GET /metrics/test}: java.lang.IllegalStateException: UT000002: The response has already been started
      	at io.undertow.server.HttpServerExchange.setStatusCode(HttpServerExchange.java:1406)
      	at org.wildfly.extension.microprofile.metrics.MetricsContextService$1.lambda$handleRequest$0(MetricsContextService.java:85)
      	at io.smallrye.metrics.MetricsRequestHandler.handleRequest(MetricsRequestHandler.java:142)
      	at io.smallrye.metrics.MetricsRequestHandler.handleRequest(MetricsRequestHandler.java:73)
      	at org.wildfly.extension.microprofile.metrics.MetricsContextService$1.handleRequest(MetricsContextService.java:84)
      	at org.jboss.as.domain.http.server.security.RealmReadinessHandler.handleRequest(RealmReadinessHandler.java:51)
      	at org.jboss.as.domain.http.server.security.ServerErrorReadinessHandler.handleRequest(ServerErrorReadinessHandler.java:35)
      	at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:91)
      	at io.undertow.server.handlers.ChannelUpgradeHandler.handleRequest(ChannelUpgradeHandler.java:211)
      	at io.undertow.server.handlers.cache.CacheHandler.handleRequest(CacheHandler.java:92)
      	at io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:78)
      	at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49)
      	at org.jboss.as.domain.http.server.ManagementHttpRequestHandler.handleRequest(ManagementHttpRequestHandler.java:57)
      	at org.jboss.as.domain.http.server.cors.CorsHttpHandler.handleRequest(CorsHttpHandler.java:75)
      	at org.jboss.as.domain.http.server.ManagementHttpServer$UpgradeFixHandler.handleRequest(ManagementHttpServer.java:664)
      	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
      	at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:255)
      	at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
      	at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162)
      	at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100)
      	at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57)
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291)
      	at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286)
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at org.xnio.nio.QueuedNioTcpServer$1.run(QueuedNioTcpServer.java:132)
      	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
      	at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)
      

      This exception is caused by following request:

      $ curl -v http://localhost:9990/metrics/test
      *   Trying ::1:9990...
      * TCP_NODELAY set
      * connect to ::1 port 9990 failed: Connection refused
      *   Trying 127.0.0.1:9990...
      * TCP_NODELAY set
      * Connected to localhost (127.0.0.1) port 9990 (#0)
      > GET /metrics/test HTTP/1.1
      > Host: localhost:9990
      > User-Agent: curl/7.65.3
      > Accept: */*
      > 
      * Mark bundle as not supporting multiuse
      < HTTP/1.1 404 Not Found
      < Connection: keep-alive
      < Content-Length: 25
      < Date: Thu, 22 Aug 2019 14:57:20 GMT
      < 
      * Connection #0 to host localhost left intact
      Bad scope requested: test
      
      The 404 Not Found HTTP response code is expected and also 'Bad scope request: test' in this case. Although, I think that mentioned IllegalStateException should be avoided. Also, this exception is not thrown in WildFly 17.0.1.
      

              jmesnil1@redhat.com Jeff Mesnil
              jstourac@redhat.com Jan Stourac
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: