SO_RCVBUF and SO_SNDBUF options problem for network channels on MacOS

XMLWordPrintable

    • b149
    • Verified

      The following code will produce the following output on MacOS:
      ——————————————————————————
      AsynchronousServerSocketChannel channel = AsynchronousServerSocketChannel.open(
                  AsynchronousChannelGroup.withThreadPool(Executors.newCachedThreadPool(Thread::new)));
          System.out.println("Initial value: " + channel.getOption(StandardSocketOptions.SO_RCVBUF));
          System.out.println("Value to set: " + Integer.MAX_VALUE);
          channel.setOption(StandardSocketOptions.SO_RCVBUF, Integer.MAX_VALUE);
          System.out.println("Result value: " + channel.getOption(StandardSocketOptions.SO_RCVBUF));
      }
      ——————————————————————————

      Output (jdk9b144):
      ——————————————————————————
      Initial value: 131072
      Value to set: 2147483647
      Result value: 65536
      ——————————————————————————
      Output (jdk9b142):
      ——————————————————————————
      Initial value: 131072
      Value to set: 2147483647
      Result value: 6710884
      ——————————————————————————

      As you can see b144 returns the value that is smaller then the initial value despite the fact that we tried to set the value that is bigger then the initial value. Seems, this is incorrect.

            Assignee:
            Michael McMahon
            Reporter:
            Elena Votchennikova (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: