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

java SEGVS when using multicastSocket

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      sparc
    • OS:
      solaris_9
    • Verification:
      Not verified

      Description

      I am using JDK1.0.2 on Solaris 2.5.1 on sun4m and get a SEGV when trying
      to use a multicastSocket

      First of all I get a SocketException when trying to call joinGroup()

      I can't figure out why this happens ..

      Then if I ignore the exception and press on Java SEGVs.
      I know that you shouldn't ignore the Exception, but
      1) Java shouldn't SEGV !!
      2) Customer appears to get the SEGV without an Exception.

      I believe that the sun.net stuff is not a public interface, but I think its
      still supposed to work.

      Here is what is printed and further down is the sample program

      java MulticastServer multicast-test
      multicast-test/224.0.0.99
      1
      SIGSEGV 11* segmentation violation
          si_signo [11]: SIGSEGV 11* segmentation violation
          si_errno [0]: Error 0
          si_code [1]: SEGV_ACCERR [addr: 0x0]

              stackbase=EFFFF03C, stackpointer=EFFFED20

      Full thread dump:
          "Finalizer thread" (TID:0xee3003b0, sys_thread_t:0xef460de0) prio=1
          "Async Garbage Collector" (TID:0xee300368, sys_thread_t:0xef490de0) prio=1
          "Idle thread" (TID:0xee300320, sys_thread_t:0xef4c0de0) prio=0
          "clock handler" (TID:0xee3001f8, sys_thread_t:0xef4f0de0) prio=11
          "main" (TID:0xee3000a0, sys_thread_t:0x76e80) prio=5 *current thread*
              java.net.DatagramSocket.send(DatagramSocket.java:84)
              sun.net.MulticastSocket.send(MulticastSocket.java:96)
              MulticastServer.main(MulticastServer.java:63)
      Monitor Cache Dump:
          sun.net.MulticastSocket@EE300DC8/EE337880 (key=0xee300dc8): monitor owner: "main"
      Registered Monitor Dump:
          Finalize me queue lock: unowned
          Thread queue lock: unowned
          Class lock: unowned
          Java stack lock: unowned
          Code rewrite lock: unowned
          Heap lock: unowned
          Has finalization queue lock: unowned
          Monitor IO lock: unowned
          Child death monitor: unowned
          Event monitor: unowned
          I/O monitor: unowned
          Alarm monitor: unowned
              Waiting to be notified:
                  "clock handler"
          Sbrk lock: unowned
          Monitor cache lock: unowned
          Monitor registry: monitor owner: "main"
      Thread Alarm Q:
      Abort




      import java.net.*;
      import java.io.*;
      import sun.net.MulticastSocket;


      public class MulticastServer {

        protected static int defaultPort = 19;
        public static String characters =

      "!\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefgh"
      + "\\r\\n"
          +
      "\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghi"
      + "\\r\\n"
          +
      "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghij"
      + "\\r\\n"
          +
      "$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijk"
      + "\\r\\n"
          +
      "%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijkl"
      + "\\r\\n"
          +
      "&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklm"
      + "\\r\\n";
        static byte[] data = new byte[characters.length()];

        public static void main(String[] args) {

          MulticastSocket ms=null;
          InetAddress ia = null;
          DatagramPacket dp = new DatagramPacket(data, data.length);

          // read the address from the command line
          try {
            ia = InetAddress.getByName(args[0]);
            System.out.println(ia.toString());
           }
          catch (Exception e) {
            System.err.println(e);
            System.err.println("Usage: java MulticastServer MulticastAddress");
            System.exit(1);
          }

          try {
            ms = new MulticastSocket();
          } catch (SocketException se) {
            System.out.println("Couldn't create socket");
            System.err.println(se);
          }
          try {
            ms.joinGroup(ia);
          }
          catch (SocketException se) {
            System.out.println("Couldn't join");
            System.err.println(se);
          }
          try {
            for (int i = 1; i < 10; i++) {
              System.out.println(i);
              ms.send(dp, (byte) 1);
              System.out.println("sent");
            }
          }
          catch (SocketException se) {
            System.out.println("Couldn't send on socket");
            System.err.println(se);
          }
          catch (IOException ie) {
            System.out.println("Couldn't write on socket");
            System.err.println(ie);
          }
          
            ms.close();
          

        }

      }

        Attachments

          Activity

            People

            Assignee:
            busersunw Btplusnull User (Inactive)
            Reporter:
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: