Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1084

Accidental dispatch on IO thread when using EagerFormParsingHandler

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.0.0.Beta1, 1.4.17.Final
    • 1.4.11.Final
    • Core
    • None

      I am using the EagerFormParsingHandler.

      In my subsequent handler I am using

      HttpServerExchange.dispatch(Runnable)

      in order to delegate my work to a worker thread.

      However, since FormEncodedDataDefinition dispatches to the subsequent handler using a SameThreadExecutor, that same executor is the 'dispatchExecutor' on the request and the worker thread pool is not used in my handler.

      The call stack when this occurs looks like this:

      <my handler here>
      io.undertow.util.SameThreadExecutor.execute (SameThreadExecutor.java:35, bci=1, compiled)
      io.undertow.server.Connectors.executeRootHandler (Connectors.java:228, bci=105, compiled)
      io.undertow.server.HttpServerExchange$1.run (HttpServerExchange.java:809, bci=8, compiled)
      io.undertow.util.SameThreadExecutor.execute (SameThreadExecutor.java:35, bci=1, compiled)
      io.undertow.server.HttpServerExchange.dispatch (HttpServerExchange.java:794, bci=76, compiled)
      io.undertow.server.HttpServerExchange.dispatch (HttpServerExchange.java:812, bci=13, compiled)
      io.undertow.server.handlers.form.FormEncodedDataDefinition$FormEncodedDataParser.handleEvent (FormEncodedDataDefinition.java:117, bci=24, compiled)
      io.undertow.server.handlers.form.FormEncodedDataDefinition$FormEncodedDataParser.handleEvent (FormEncodedDataDefinition.java:90, bci=5, compiled)
      org.xnio.ChannelListeners.invokeChannelListener (ChannelListeners.java:92, bci=18, compiled)
      io.undertow.channels.DetachableStreamSourceChannel$SetterDelegatingListener.handleEvent (DetachableStreamSourceChannel.java:231, bci=17, compiled)
      io.undertow.channels.DetachableStreamSourceChannel$SetterDelegatingListener.handleEvent (DetachableStreamSourceChannel.java:218, bci=5, compiled)
      org.xnio.ChannelListeners.invokeChannelListener (ChannelListeners.java:92, bci=18, compiled)
      org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady (ReadReadyHandler.java:66, bci=34, compiled)
      org.xnio.nio.NioSocketConduit.handleReady (NioSocketConduit.java:88, bci=51, compiled)
      org.xnio.nio.WorkerThread.run (WorkerThread.java:559, bci=842, compiled)
      

      This caused unexpected blockage of an IO thread since HttpServerExchange#dispatch(Runnable) states that it will occur on the worker thread pool, but that's not what actually happened.

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              proyal_jira peter royal (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: