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

Missing messages when sending asynchronously

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1.3, 2.1.4
    • Fix Version/s: 2.2.0
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Linux

      Description

      I found an issue on 2.1.x branch when a client is sending messages asynchronously.

      I create a simple client and a server with a simple ObjectSerializationCodecFactory.
      On a client, I send simple String messages (e.g. Message:1) inside a thread pool (size=2).
      Then I check:

      • On client, I check that I send all these messages and avoid duplicate.
      • On server, I check that I receive all these messages.

      If client send "1000" messages on thread pool with 2 threads, server will miss 11messages:

      12:24:59,573 INFO <main> missingMessageTest.begin with 1000 messages and 2 threads
      12:24:59,577 INFO <main> missingMessageTest.end
      12:24:59,577 INFO <main> missingMessageTest.sleep... 1000
      12:24:59,580 ERROR <NioProcessor-14> messageSent: message <Message:21> already sent
      12:24:59,581 ERROR <NioProcessor-14> messageSent: message <Message:27> already sent
      12:24:59,584 ERROR <NioProcessor-14> messageSent: message <Message:113> already sent
      12:24:59,587 ERROR <NioProcessor-14> messageSent: message <Message:164> already sent
      12:24:59,592 ERROR <NioProcessor-14> messageSent: message <Message:313> already sent
      12:24:59,596 ERROR <NioProcessor-14> messageSent: message <Message:386> already sent
      12:24:59,604 ERROR <NioProcessor-14> messageSent: message <Message:567> already sent
      12:24:59,605 ERROR <NioProcessor-14> messageSent: message <Message:615> already sent
      12:24:59,606 ERROR <NioProcessor-14> messageSent: message <Message:628> already sent
      12:24:59,611 ERROR <NioProcessor-14> messageSent: message <Message:760> already sent
      12:24:59,612 ERROR <NioProcessor-14> messageSent: message <Message:822> already sent
      12:25:00,578 INFO <main> missingMessageTest.sleep... 2000
      12:25:01,578 INFO <main> missingMessageTest.sleep... 3000
      12:25:02,579 INFO <main> missingMessageTest.sleep... 4000
      12:25:03,579 INFO <main> missingMessageTest.sleep... 5000
      12:25:04,579 INFO <main> missingMessageTest.close
      12:25:04,582 ERROR <main> missing <11> messages : [Message:760, Message:27, Message:21, Message:313, Message:567, Message:822, Message:615, Message:628, Message:386, Message:113, Message:164]
      

      I works fine with one thread (e.g. synchronous send).
      This junit works with "Apache Mina" "2.0.21", it failed with "2.1.x" branch.

      I attach my junit to reproduce this issue on your side.

       

       

        Attachments

        1. ClientServerTest.java
          6 kB
          Maxime Leur

          Issue Links

            Activity

              People

              • Assignee:
                johnnyv Jonathan Valliere
                Reporter:
                maxime.leur Maxime Leur
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: