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

Undertow stuck on Channels.writeBlocking when the peer closed the request

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • None
    • Core
    • None

    Description

      We had a file descriptor leakage issue and believe it is rooted in this. We are not setting the WriteListener so we are performing a synchronous write according to the code. We are stuck at Channels.writeBlocking, which is called without a timeout.

      We are able to reproduce this when the peer closes the connection as we are trying to reply. The call can block and return minutes later. We measured responses back up to 16 minutes later. Unfortunately this can cause thread exhaustion, high load, retries, escalating the "leak".

      sdouglas1@redhat.com do you think having a configurable writeBlocking timeout would work? Something that would allow the write call to return in seconds and not minutes...

      "XNIO-2 task-43" #228 prio=5 os_prio=0 tid=0x00002b768000f000 nid=0x6cc2 runnable [0x00002b73c3935000]
         java.lang.Thread.State: RUNNABLE
              at sun.nio.ch.PollArrayWrapper.poll0(Native Method)
              at sun.nio.ch.PollArrayWrapper.poll(PollArrayWrapper.java:115)
              at sun.nio.ch.PollSelectorImpl.doSelect(PollSelectorImpl.java:87)
              at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
              - locked <0x00000005ae13ccf8> (a sun.nio.ch.Util$3)
              - locked <0x00000005ae13cce8> (a java.util.Collections$UnmodifiableSet)
              - locked <0x00000005ae13cbc0> (a sun.nio.ch.PollSelectorImpl)
              at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
              at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101)
              at org.xnio.nio.SelectorUtils.await(SelectorUtils.java:46)
              at org.xnio.nio.NioSocketConduit.awaitWritable(NioSocketConduit.java:263)
              at io.undertow.conduits.IdleTimeoutConduit.awaitWritable(IdleTimeoutConduit.java:366)
              at org.xnio.conduits.AbstractSinkConduit.awaitWritable(AbstractSinkConduit.java:66)
              at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.awaitWritable(AbstractFixedLengthStreamSinkConduit.java:282)
              at org.xnio.conduits.ConduitStreamSinkChannel.awaitWritable(ConduitStreamSinkChannel.java:134)
              at io.undertow.channels.DetachableStreamSinkChannel.awaitWritable(DetachableStreamSinkChannel.java:87)
              at io.undertow.server.HttpServerExchange$WriteDispatchChannel.awaitWritable(HttpServerExchange.java:2033)
              at org.xnio.channels.Channels.writeBlocking(Channels.java:154)
              at io.undertow.servlet.spec.ServletOutputStreamImpl.writeTooLargeForBuffer(ServletOutputStreamImpl.java:197)
              at io.undertow.servlet.spec.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:145)
              at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseWrapper$DeferredOutputStream.write(HttpServletResponseWrapper.java:46)
              at org.jboss.resteasy.util.CommitHeaderOutputStream.write(CommitHeaderOutputStream.java:71)
      
      

      Attachments

        Activity

          People

            rhn-cservice-bbaranow Bartosz Baranowski
            abellina Alessandro Bellina (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: