glassfish
  1. glassfish
  2. GLASSFISH-5342

Workaround JDK bug: java.net.SocketException: Invalid argument)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 9.1.1
    • Fix Version/s: 9.1.1_dev
    • Component/s: grizzly-kernel
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      5,342
    • Status Whiteboard:
      Hide

      911Approved

      Show
      911Approved

      Description

      Grizzly is throwing the following exception on Solaris:

      java.net.SocketException: Invalid argument
      at sun.nio.ch.Net.setIntOption0(Native Method)
      at sun.nio.ch.Net.setIntOption(Net.java:152)
      at sun.nio.ch.SocketChannelImpl$1.setInt(SocketChannelImpl.java:372)
      at sun.nio.ch.SocketOptsImpl.setBoolean(SocketOptsImpl.java:38)
      at sun.nio.ch.SocketOptsImpl$IP$TCP.noDelay(SocketOptsImpl.java:284)
      at sun.nio.ch.OptionAdaptor.setTcpNoDelay(OptionAdaptor.java:48)
      at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:268)
      at
      com.sun.enterprise.web.connector.grizzly.SelectorThread.setSocketOptions(SelectorThread.java:1902)
      at
      com.sun.enterprise.web.connector.grizzly.SelectorThread.handleAccept(SelectorThread.java:1475)
      at
      com.sun.enterprise.web.connector.grizzly.SelectorThread.handleConnection(SelectorThread.java:1439)
      at
      com.sun.enterprise.web.connector.grizzly.SelectorThread.doSelect(SelectorThread.java:1350)
      at
      com.sun.enterprise.web.connector.grizzly.SelectorThread.startListener(SelectorThread.java:1284)
      at
      com.sun.enterprise.web.connector.grizzly.SelectorThread.startEndpoint(SelectorThread.java:1247)
      at
      com.sun.enterprise.web.connector.grizzly.SelectorThread.run(SelectorThread.java:1223)

      This is a JDK issue, reproducible by just doing:

      import java.nio.channels.*;

      public class Test {
      public static void main(String[] args) throws Exception

      { SocketChannel sc = SocketChannel.open(); sc.configureBlocking(false); Selector sel = Selector.open(); sc.register(sel, 0); sel.selectNow(); sc.close(); sc.socket().setTcpNoDelay(false); }

      }

      Workaround: Make sure the Channel is open before calling setXXX on it.

        Activity

        Hide
        jfarcand added a comment -

        Simple to fix.

        Show
        jfarcand added a comment - Simple to fix.
        Hide
        harpreet added a comment -

        Approved for v2.1

        Show
        harpreet added a comment - Approved for v2.1
        Hide
        jfarcand added a comment -

        Fixed

        Checking in src/java/com/sun/enterprise/web/connector/grizzly/SelectorThread.java;
        /cvs/glassfish/appserv-http-engine/src/java/com/sun/enterprise/web/connector/grizzly/SelectorThread.java,v
        <-- SelectorThread.java
        new revision: 1.123.2.5; previous revision: 1.123.2.4
        done

        Show
        jfarcand added a comment - Fixed Checking in src/java/com/sun/enterprise/web/connector/grizzly/SelectorThread.java; /cvs/glassfish/appserv-http-engine/src/java/com/sun/enterprise/web/connector/grizzly/SelectorThread.java,v <-- SelectorThread.java new revision: 1.123.2.5; previous revision: 1.123.2.4 done

          People

          • Assignee:
            jfarcand
            Reporter:
            jfarcand
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: