Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-1436

APPEND IMAP command can result in JAMES IMAP waiting indefinitely for data

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Trunk, 3.0-beta4, 3.0.0-beta5
    • 3.7.0, 3.6.1
    • IMAPServer
    • None
    • Ubuntu 12.04 x86_64

    Description

      When processing an IMAP APPEND command, the Netty stack in JAMES IMAP can get into a state where the ImapRequestFrameDecoder will wait for a number message bytes that will never arrive.

      This has the effect of causing the IMAP client to also block indefinitely waiting for a response from the server.

      Root Cause:
      This is due to a race condition when the DelimiterBasedFrameDecoder is removed from the Netty pipeline by the ImapRequestFrameDecoder.

      If the DelimiterBasedFrameDecoder still contains less than one line of data in its buffer, that data will never be flushed and forwarded down the pipeline. The effect of this is that a small number of bytes, typically from the early part of the message are omitted and the final byte count does not match the value calculated from the APPEND command. This results in the APPEND command never being completely decoded and hence no append actually takes place nor does a response get sent to the client.

      In order to reliably trigger this bug, JAMES was configured to accept a remote debugging connection and a conditional breakpoint set at org.jboss.netty.handler.codec.frame.FrameDecoder:439. The condition was set to 'Thread.sleep(200l); false'. This results in introducing a 200ms delay on each frame decoding loop without actually hitting the breakpoint. The effect of this is to allow the threadpool running ImapRequestFrameDecoder time to consume the individual frames and remove the DelimiterBasedFrameDecoder from the pipeline.

      Attachments

        1. JAMES-1436.patch.r1432540
          7 kB
          Jerry Tian
        2. ThunderbirdAndIMAPserver.log
          17 kB
          Peter Kvokacka
        3. JAMES-1436.patch
          7 kB
          Samant Maharaj

        Activity

          People

            Unassigned Unassigned
            samboneym Samant Maharaj
            Votes:
            5 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 40m
                1h 40m