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

IllegalArgumentException when setting max and minReadBufferSize > 65536 (default)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 2.0.9
    • 2.0.17
    • Transport
    • None

    Description

      After setting the max and minReadBufferSize to 256k on the acceptor's session config, the following error is thrown when a client connects:

      java.lang.IllegalArgumentException: minReadBufferSize: 262144 (expected: smaller than 65536)
      	at org.apache.mina.core.session.AbstractIoSessionConfig.setMinReadBufferSize(AbstractIoSessionConfig.java:110)
      	at org.apache.mina.core.session.AbstractIoSessionConfig.setAll(AbstractIoSessionConfig.java:60)
      	at org.apache.mina.transport.socket.nio.NioSocketSession.<init>(NioSocketSession.java:65)
      	at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:200)
      	at org.apache.mina.transport.socket.nio.NioSocketAcceptor.accept(NioSocketAcceptor.java:51)
      	...
      

      These two lines seems to be the problem

      AbstractIoSessionConfig.java
       setMinReadBufferSize(config.getMinReadBufferSize());
       setMaxReadBufferSize(config.getMaxReadBufferSize());
      

      This is due to the fact that there is a check when setting the minReadBuffer (it should be > than maxReadBufferSize) but the max isn't set yet so it compares it with the default value (64k).

      Possible fix: just swap the lines, setting the maxReadBufferSize first.

      Attachments

        Activity

          People

            Unassigned Unassigned
            spac.valentin Spac Valentin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: