Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-782

Combination of SslFilter & FileRegionWriteFilter causes messageSent events to be lost

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0-RC1
    • Fix Version/s: 2.0.8
    • Component/s: Core
    • Labels:
      None

      Description

      When SslFilter & FileRegionWriteFilter are the last 2 filters on the outgoing end of a filter chain, you lose the messageSent notification for an IoBuffer if a write of the IoBuffer is immediately followed by a write of a FileRegion.

        Activity

        Hide
        elecharny Emmanuel Lecharny added a comment -

        I applied the patch on trunk, but when running the tests, I got some failures :/

        -------------------------------------------------------------------------------
        Test set: org.apache.mina.filter.stream.FileRegionWriteFilterTest
        -------------------------------------------------------------------------------
        Tests run: 8, Failures: 2, Errors: 1, Skipped: 0, Time elapsed: 0.551 sec <<< FAILURE!
        testWriteSingleBufferFile(org.apache.mina.filter.stream.FileRegionWriteFilterTest) Time elapsed: 0.004 sec <<< FAILURE!
        java.lang.AssertionError:
        Unexpected method call filterWrite((0x0000001E: mina dummy, server, ? => ?), WriteRequest: HeapBuffer[pos=0 lim=4 cap=4: 01 02 03 04]):
        filterWrite((0x0000001E: mina dummy, server, ? => ?), Expected a WriteRequest with the message 'HeapBuffer[pos=0 lim=4 cap=4: 01 02 03 04]'): expected: 1, actual: 2
        messageSent((0x0000001E: mina dummy, server, ? => ?), WriteRequest: org.apache.mina.core.file.DefaultFileRegion@48baa31b): expected: 1, actual: 0
        at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:43)
        at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:72)
        at $Proxy7.filterWrite(Unknown Source)
        at org.apache.mina.filter.stream.AbstractStreamWriteFilter.filterWrite(AbstractStreamWriteFilter.java:103)
        at org.apache.mina.filter.stream.AbstractStreamWriteFilterTest.testWriteSingleBufferFile(AbstractStreamWriteFilterTest.java:162)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        Show
        elecharny Emmanuel Lecharny added a comment - I applied the patch on trunk, but when running the tests, I got some failures :/ ------------------------------------------------------------------------------- Test set: org.apache.mina.filter.stream.FileRegionWriteFilterTest ------------------------------------------------------------------------------- Tests run: 8, Failures: 2, Errors: 1, Skipped: 0, Time elapsed: 0.551 sec <<< FAILURE! testWriteSingleBufferFile(org.apache.mina.filter.stream.FileRegionWriteFilterTest) Time elapsed: 0.004 sec <<< FAILURE! java.lang.AssertionError: Unexpected method call filterWrite((0x0000001E: mina dummy, server, ? => ?), WriteRequest: HeapBuffer [pos=0 lim=4 cap=4: 01 02 03 04] ): filterWrite((0x0000001E: mina dummy, server, ? => ?), Expected a WriteRequest with the message 'HeapBuffer [pos=0 lim=4 cap=4: 01 02 03 04] '): expected: 1, actual: 2 messageSent((0x0000001E: mina dummy, server, ? => ?), WriteRequest: org.apache.mina.core.file.DefaultFileRegion@48baa31b): expected: 1, actual: 0 at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:43) at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:72) at $Proxy7.filterWrite(Unknown Source) at org.apache.mina.filter.stream.AbstractStreamWriteFilter.filterWrite(AbstractStreamWriteFilter.java:103) at org.apache.mina.filter.stream.AbstractStreamWriteFilterTest.testWriteSingleBufferFile(AbstractStreamWriteFilterTest.java:162) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        Hide
        elecharny Emmanuel Lecharny added a comment -

        Postponed to 2.0.1

        Show
        elecharny Emmanuel Lecharny added a comment - Postponed to 2.0.1
        Hide
        acbatwork Adam Brown added a comment -

        This patch makes AbstractStreamWriteFilter keep track of the WriteRequests for the current "stream" that is being broken into IoBuffers. This resolves the problem of the lost messageSent events.

        Show
        acbatwork Adam Brown added a comment - This patch makes AbstractStreamWriteFilter keep track of the WriteRequests for the current "stream" that is being broken into IoBuffers. This resolves the problem of the lost messageSent events.
        Hide
        acbatwork Adam Brown added a comment -

        This file demonstrates the problem described in this bug. The expected behavior would be to see the following messages on stdout.

        messageReceived: HeapBuffer[pos=0 lim=6 cap=37: 61 64 73 66 0D 0A]

        messageSent: HeapBuffer[pos=0 lim=11 cap=11: 74 65 73 74 20 73 74 72 69 6E 67]

        messageSent: org.apache.mina.core.file.DefaultFileRegion@1f950198
        session closed (0x00000001: nio socket, server, /127.0.0.1:44888 => /60.127.0.0:46609)

        However, the follow messages are actually seen with 2.0.0-RC1 code:

        messageReceived: HeapBuffer[pos=0 lim=6 cap=37: 61 73 64 66 0D 0A]

        messageSent: org.apache.mina.core.file.DefaultFileRegion@203fa5ac

        messageSent: HeapBuffer[pos=0 lim=3923 cap=3923: 2D 2D 2D 20 2F 68 6F 6D 65 2F 61 62 72 6F 77 6E...]
        session closed (0x00000001: nio socket, server, /127.0.0.1:33608 => /3.127.0.0:30214)

        Show
        acbatwork Adam Brown added a comment - This file demonstrates the problem described in this bug. The expected behavior would be to see the following messages on stdout. messageReceived: HeapBuffer [pos=0 lim=6 cap=37: 61 64 73 66 0D 0A] messageSent: HeapBuffer [pos=0 lim=11 cap=11: 74 65 73 74 20 73 74 72 69 6E 67] messageSent: org.apache.mina.core.file.DefaultFileRegion@1f950198 session closed (0x00000001: nio socket, server, /127.0.0.1:44888 => /60.127.0.0:46609) However, the follow messages are actually seen with 2.0.0-RC1 code: messageReceived: HeapBuffer [pos=0 lim=6 cap=37: 61 73 64 66 0D 0A] messageSent: org.apache.mina.core.file.DefaultFileRegion@203fa5ac messageSent: HeapBuffer [pos=0 lim=3923 cap=3923: 2D 2D 2D 20 2F 68 6F 6D 65 2F 61 62 72 6F 77 6E...] session closed (0x00000001: nio socket, server, /127.0.0.1:33608 => /3.127.0.0:30214)

          People

          • Assignee:
            elecharny Emmanuel Lecharny
            Reporter:
            acbatwork Adam Brown
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development