JDK-7014244 : (so) setTcpNoDelay fails with "Invalid argument" on Windows Vista
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 2011-01-24
  • Updated: 2012-10-03
  • Resolved: 2012-10-03
Related Reports
Relates :  
Description
Application client sometimes gets an exception on Windows Vista (JDK 7 b126, also reproducible with JDK 6 update releases and with -Djava.net.preferIPv4Stack=true):

Jan 24, 2011 6:24:43 AM com.sun.grizzly.nio.transport.TCPNIOTransport configureChannel
WARNING: Can not set TcpNoDelay to true
java.net.SocketException: Invalid argument: no further information
        at sun.nio.ch.Net.setIntOption0(Native Method)
        at sun.nio.ch.Net.setSocketOption(Net.java:264)
        at sun.nio.ch.SocketChannelImpl.setOption(SocketChannelImpl.java:180)
        at sun.nio.ch.SocketAdaptor.setBooleanOption(SocketAdaptor.java:286)
        at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:321)
        at com.sun.grizzly.nio.transport.TCPNIOTransport.configureChannel(TCPNIOTransport.java:552)
        at com.sun.grizzly.nio.transport.TCPNIOConnectorHandler$ConnectorEventProcessor.process(TCPNIOConnectorH
andler.java:245)
        at com.sun.grizzly.ProcessorRunnable.run(ProcessorRunnable.java:217)
        at com.sun.grizzly.utils.CurrentThreadExecutor.execute(CurrentThreadExecutor.java:52)
        at com.sun.grizzly.strategies.WorkerThreadStrategy.executeProcessor(WorkerThreadStrategy.java:101)
        at com.sun.grizzly.nio.transport.TCPNIOTransport.executeProcessor(TCPNIOTransport.java:709)
        at com.sun.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:679)
        at com.sun.grizzly.nio.SelectorRunner.fire(SelectorRunner.java:386)
        at com.sun.grizzly.nio.SelectorRunner.iterateKeyEvents(SelectorRunner.java:361)
        at com.sun.grizzly.nio.SelectorRunner.iterateKeys(SelectorRunner.java:288)
        at com.sun.grizzly.nio.SelectorRunner.doSelect(SelectorRunner.java:260)
        at com.sun.grizzly.nio.SelectorRunner.run(SelectorRunner.java:191)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:732)

Comments
I've decided to close this bug as there is nothing we can do. All along we've suspected this to be a Windows Vista bug and have only been able to duplicate it on one machine. If someone can reliably duplicate it on Windows 7 or Windows 8 and can give us information to suggest this is a JDK bug then please submit a new bug or re-open this bug.
03-10-2012

EVALUATION This duplicates with a test using OpenDS server on Windows Vista. The underlying setsockopt is failing but the parameters seem correct. It works when retried immediately, which suggests this may actually be a Windows Vista bug. We need to see if we can duplicate it on other versions of Windows.
08-03-2011