Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4849277

(so) DatagramChannel.send() throws unexpected exception

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b26
    • CPU:
      generic, sparc
    • OS:
      generic, solaris_8

      Description



      Name: auR10023 Date: 04/16/2003



      java.nio.channels.DatagramChannel.send(ByteBuffer src, SocketAddress target)
      throws unexpected SocketException on solaris.

      Here is the example:

      -------test.java---------

      import java.io.*;
      import java.net.*;
      import java.nio.*;
      import java.nio.channels.*;

      public class test {
          static InetSocketAddress getFreeISA() throws IOException {
              ServerSocket soc = new ServerSocket(0);
              int port = soc.getLocalPort();
              soc.close();
              return new InetSocketAddress(InetAddress.getLocalHost(), port);
          }

          public static void main(String [] args) {
              try {
                  InetSocketAddress sender = getFreeISA();
                  DatagramChannel sndChannel = DatagramChannel.open();
                  sndChannel.socket().bind(sender);

                  InetSocketAddress receiver = getFreeISA();
                  DatagramChannel rcvChannel = DatagramChannel.open();
                  rcvChannel.socket().bind(receiver);
                  rcvChannel.connect(sender);

                  sndChannel.connect(receiver);

                  sndChannel.send(ByteBuffer.allocate(10), receiver);

              } catch (IOException e) {
                  e.printStackTrace(System.out);
                  return;
              }
              System.out.println("OKAY");
          }
      }

      Here is the result on solaris 5.9
      #java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b04)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b04, mixed mode)

      #java test

      java.net.SocketException: Transport endpoint is already connected
              at sun.nio.ch.DatagramChannelImpl.send0(Native Method)
              at sun.nio.ch.DatagramChannelImpl.sendFromNativeBuffer(DatagramChannelImpl.java:289)
              at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:272)
              at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:243)
              at test.main(test.java:27)

      Here is the result on linux (kernel 2.4.18)
      #java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b04)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b04, mixed mode)

      #java test
      OKAY

      ======================================================================


      Note, also JCK1.5-runtime api/java_nio/channels/DatagramChannel/index.html#Generated
      fails as a result of this bug:

      Name: mmR10223 Date: 08/28/2003


      Filed By : J2SE-SQA [###@###.###
      JDK : JDK1.5.0-b15 (b02)
      JCK : JCK1.5-runtime
      Platform[s] : Solaris (sparc, x86)
      switch/Mode : default
      JCK test owner : http://javaweb.eng/jck/usr/owners.jto
      Falling test[s]:
              api/java_nio/channels/DatagramChannel/index.html#Generated [DatagramChannel0034, DatagramChannel0035, DatagramChannel0036, DatagramChannel0037, DatagramChannel0042, DatagramChannel0043, DatagramChannel0044, DatagramChannel0045, DatagramChannel0050, DatagramChannel0051, DatagramChannel0052, DatagramChannel0053, DatagramChannel0058, DatagramChannel0059, DatagramChannel0060, DatagramChannel0061]

      This is a new test which is absent in previous JCK. It fails using all JDK1.5.0,
      JDK1.4.2 builds on Solaris (sparc, x86) platforms only, but it passes on other platforms.
      The test hangs if it is run using script which is shown below.


      Test source location:
      =====================
      /java/re/jck/1.5/promoted/latest/binaries/JCK-runtime-5/tests/api/java_nio/channels/DatagramChannel/GeneratedTests.java

      jtr file location:
      ==================
      /net/jtgb4u4c.sfbay/export/sail15/results.2/tiger/b15/jck15/sparc/sol10_sparc_gnome_client_d64_enablesystemassertions_linux-8/workDir/api/java_nio/channels/DatagramChannel/index_Generated.jtr

      How to reproduce:
      =================
      Run the following script (you may need to change its variables)
       
      --- script start ---
      #!/bin/bash

      JCK="/java/re/jck/1.5/promoted/latest/binaries/JCK-runtime-15"
      JDK="/java/re/jdk/1.5.0/promoted/latest/binaries/solaris-sparc"
      CLASSPATH="$JCK/classes:$JCK/lib/javatest.jar"
       
      $JDK/bin/java $switches -cp $CLASSPATH javasoft.sqe.tests.api.java.nio.channels.DatagramChannel.GeneratedTests -network.tcpPortRange 0
      --- script end ---

      Script output:
      ============
      Test hangs

      Test output:
      ============
      DatagramChannel0030: Passed. OKAY
      DatagramChannel0031: Passed. OKAY
      DatagramChannel0032: Passed. OKAY
      DatagramChannel0033: Passed. OKAY
      DatagramChannel0034: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0035: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0036: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0037: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0038: Passed. OKAY
      DatagramChannel0039: Passed. OKAY
      DatagramChannel0040: Passed. OKAY
      DatagramChannel0041: Passed. OKAY
      DatagramChannel0042: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0043: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0044: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0045: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0046: Passed. OKAY
      DatagramChannel0047: Passed. OKAY
      DatagramChannel0048: Passed. OKAY
      DatagramChannel0049: Passed. OKAY
      DatagramChannel0050: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0051: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0052: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0053: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0054: Passed. OKAY
      DatagramChannel0055: Passed. OKAY
      DatagramChannel0056: Passed. OKAY
      DatagramChannel0057: Passed. OKAY
      DatagramChannel0058: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0059: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0060: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0061: Failed. Unexpected java.net.SocketException: Transport endpoint is already connected
      DatagramChannel0062: Passed. OKAY
      DatagramChannel0063: Passed. OKAY
      DatagramChannel0064: Passed. OKAY
      DatagramChannel0065: Passed. OKAY
      DatagramChannel0066: Passed. OKAY
      DatagramChannel0067: Passed. OKAY
      DatagramChannel0068: Passed. OKAY
      DatagramChannel0069: Passed. OKAY
      DatagramChannel0070: Passed. OKAY
      DatagramChannel0071: Passed. OKAY
      DatagramChannel0072: Passed. OKAY
      DatagramChannel0073: Passed. OKAY
      DatagramChannel0074: Passed. OKAY
      DatagramChannel0075: Passed. OKAY
      DatagramChannel0076: Passed. OKAY
      DatagramChannel0077: Passed. OKAY
      DatagramChannel0078: Passed. OKAY
      DatagramChannel0079: Passed. OKAY
      DatagramChannel0080: Passed. OKAY
      DatagramChannel0081: Passed. OKAY
      DatagramChannel0082: Passed. OKAY
      DatagramChannel0083: Passed. OKAY
      DatagramChannel0084: Passed. OKAY
      DatagramChannel0085: Passed. OKAY
      STATUS:Failed.test cases: 56; passed: 40; failed: 16; first test case failure: DatagramChannel0034
      result: Failed. test cases: 56; passed: 40; failed: 16; first test case failure: DatagramChannel00

      Specific machine info:
      ======================
      Hostname: linux-8
      OS: Solaris 10 (sparc) (GNOME)
      Hostname: linux-6
      OS: Solaris 9 (x86) (CDE)


      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mmcclosksunw Michael Mccloskey (Inactive)
              Reporter:
              avusunw Avu Avu (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: