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

AbstractFramedChannel readData race

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.2.13.Final, 2.0.42.Final
    • 2.2.7.Final
    • None
    • None

    Description

      Twice we have observed the following NPE:

      java.lang.NullPointerException
              at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:1015)
              at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener.handleEvent(AbstractFramedChannel.java:990)
              at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
              at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameCloseListener$1.run(AbstractFramedChannel.java:1001)
              at io.undertow.server.protocol.framed.AbstractFramedChannel$1.run(AbstractFramedChannel.java:144)
              at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
              at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)
      

      Investigation pointed to a data race around readData. In particular, it looks like here, readData is null before the &&, and null afterward, eliciting the NPE.

      The only un-synchronized modification I see of readData is here, and I consider this the prime suspect, but I'm not yet familiar enough with the workings and lifecycle of the AbstractFramedChannel to be 100% certain.

      If pressed, I would suggest that:

      1. AbstractFramedChannel.close be synchronized, and
      2. Remaining instances of (readData != null && ...) be wrapped in appropriate synchronized blocks.

      If I can convince myself of the proper fix I'll contribute it. In any case, thanks in advance for taking a look and providing feedback.

      Attachments

        Activity

          People

            rhn-cservice-bbaranow Bartosz Baranowski
            alan-14 Alan Dipert (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: