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

Java Segmentation violation while loading native code

XMLWordPrintable

    • generic
    • solaris_2.6


      tushar.patel@West 1998-07-27
      System: Sun Solaris

      >Description:

      Upon initial start of the LAI a segmentatiojn violation may occur.

      The problem occurs on the Sun Solaris platform and is an intermittent problem.
      It occurs infrequently about 1 in 10 or 1 in 15 times, although the violation
      may not occur after 25 times.

      The segmentation violation only appears during the loading of native code
      libraries - java.lang.Runtime.loadLibrary.

      The problem does not occur consistently with a particular native library

      There are 7 native library modules loaded. The library loading is done in
      main().

      The Sun Java Developer connection bug report list shows this problem was
      previously reported, but closed because it was not reproducible!

      This defect is most likely a Sun Java problem. A bug report was filed with
      Sun Java for version JDK 1.1.5.

      >How-To-Repeat:

      The problem cannot be reproduced consistently.

      >Fix:

      If the segmentation violation occurs, start up the LAI again.

      It is very unlikely to fail a second time, but if it does start the LAI again.

      The problem does not affect the operation of the LAI once the native code
      libraries are loaded.

      More info:

      > Also, in your email, you mentioned that "The Sun Java Developer connection
      bug
      > report list shows this problem was previously reported, but closed because it
      was
      > not reproducible!". Can you get me the bug # for this bug ?
      >

      The bug id is 4050444 - Loading native library causes VM to coredump

      /usr/people/amodla/development/sun/vod/bin/host: showrev -a
      Hostname: sphene
      Hostid: 808775b4
      Release: 5.6
      Kernel architecture: sun4u
      Application architecture: sparc
      Hardware provider: Sun_Microsystems
      Domain: srtc.com
      Kernel version: SunOS 5.6 Generic August 1997

      OpenWindows version:
      OpenWindows Version 3.6 7 July 1997
      Patch: 105745-01 Obsoletes: Packages:


      System Configuration: Sun Microsystems sun4u
      Memory size: 128 Megabytes
      System Peripherals (Software Nodes):

      SUNW,Ultra-1-Engine
          packages (driver not attached)
              terminal-emulator (driver not attached)
              deblocker (driver not attached)
              obp-tftp (driver not attached)
              disk-label (driver not attached)
              ufs-file-system (driver not attached)
              cmdk (driver not attached)
              ufs-file-system (driver not attached)
          chosen (driver not attached)
          openprom (driver not attached)
              client-services (driver not attached)
          options, instance #0
          aliases (driver not attached)
          memory (driver not attached)
          virtual-memory (driver not attached)
          counter-timer (driver not attached)
          pci, instance #0
              ebus, instance #0
                  auxio (driver not attached)
                  power (driver not attached)
                  SUNW,pll (driver not attached)
                  sc (driver not attached)
                  se, instance #0
                  su, instance #0
                  su, instance #1
                  ecpp (driver not attached)
                  fdthree, instance #0
                  eeprom (driver not attached)
                  flashprom (driver not attached)
                  beeper (driver not attached)
              network, instance #0
              ATI,Video-Xpression, instance #0
              ide (driver not attached)
                  ata (driver not attached)
                  ata (driver not attached)
          pci, instance #1
              pci, instance #0
                  scsi, instance #0
                      disk (driver not attached)
                      tape (driver not attached)
                      sd, instance #0
                      sd, instance #1 (driver not attached)
                      sd, instance #2 (driver not attached)
                      sd, instance #3 (driver not attached)
                      sd, instance #4 (driver not attached)
                      sd, instance #30 (driver not attached)
                      sd, instance #31 (driver not attached)
                      sd, instance #32 (driver not attached)
                      sd, instance #33 (driver not attached)
                      sd, instance #34 (driver not attached)
                      sd, instance #35 (driver not attached)
                      sd, instance #36 (driver not attached)
                      sd, instance #5 (driver not attached)
                      sd, instance #6
                      sd, instance #7 (driver not attached)
                      sd, instance #8 (driver not attached)
                      sd, instance #9 (driver not attached)
                      sd, instance #10 (driver not attached)
                      sd, instance #11 (driver not attached)
                      sd, instance #12 (driver not attached)
                      sd, instance #13 (driver not attached)
                      sd, instance #14 (driver not attached)
                  scsi, instance #1
                      disk (driver not attached)
                      tape (driver not attached)
                      sd, instance #15 (driver not attached)
                      sd, instance #16 (driver not attached)
                      sd, instance #17 (driver not attached)
                      sd, instance #18 (driver not attached)
                      sd, instance #19 (driver not attached)
                      sd, instance #37 (driver not attached)
                      sd, instance #38 (driver not attached)
                      sd, instance #39 (driver not attached)
                      sd, instance #40 (driver not attached)
                      sd, instance #41 (driver not attached)
                      sd, instance #42 (driver not attached)
                      sd, instance #43 (driver not attached)
                      sd, instance #20 (driver not attached)
                      sd, instance #21 (driver not attached)
                      sd, instance #22 (driver not attached)
                      sd, instance #23 (driver not attached)
                      sd, instance #24 (driver not attached)
                      sd, instance #25 (driver not attached)
                      sd, instance #26 (driver not attached)
                      sd, instance #27 (driver not attached)
                      sd, instance #28 (driver not attached)
                      sd, instance #29 (driver not attached)
          SUNW,UltraSPARC (driver not attached)
          pseudo, instance #0


      Here is a sample output and code from the crash:

      While loading native code from main() by calling System.loadLibrary()
      the java jre program gets a segmenatation violation.
      This does not always happen. It occurs at random.
      It seems to happen more often (although not consistently) after OS
      initialization.
      Repeating execution again usually avoids the segmentation violation, but not
      always
      The same code is run each time.

      rsh used
      Sun Microsystems Inc. SunOS 5.6 Generic August 1997
      JDK 1.1.5 on Solaris using jre
      javac -g -deprecation
      JNI library loading sample code:

      /** Static method to load native code libraries */
      static void getLibrary() {
      try {
      System.loadLibrary(MAIN_MENU_LIB);
      System.out.println(MAIN_MENU_LIB + " library loaded");
      _native = true;
      Demultiplexer.getLibrary();
      Admin.getLibrary();
      AdminParams.getLibrary();
      Alarms.getLibrary();
      ContentInfo.getLibrary();
      DBS.getLibrary();
      }
      catch(UnsatisfiedLinkError e) {
      System.err.println("Unable to load " + MAIN_MENU_LIB +
      "library. Using fallback");
      _native = false;
      if (!Config.remoteMode)
      System.exit(-1);
      }
      catch (Exception e) {
      System.err.println("Unable to load " + MAIN_MENU_LIB +
      "library.");
      System.exit(-1);
      }
      }


      ContentInfo.java:
      static void getLibrary() {
      try {
      System.loadLibrary(LIB);
      System.out.println(LIB + " library loaded");
      _native = true;
      }
      catch(UnsatisfiedLinkError e) {
      System.err.println("Unable to load " + LIB + "library.
      Using fallback");
      _native = false;
      if (!Config.remoteMode)
      System.exit(-1);
      }
      catch (Exception e) {
      System.err.println("Unable to load " + LIB +
      "library.");
      System.exit(-1);
      }
      }


      MainMenu library loaded
      Demultiplexer library loaded
      Admin library loaded
      AdminParams library loaded
      Alarms library loaded
      SIGSEGV 11* segmentation violation
          si_signo [11]: SIGSEGV 11* segmentation violation
          si_errno [0]: Error 0
          si_code [1]: SEGV_MAPERR [addr: 0xef770000]

              stackbase=EFFFF5E8, stackpointer=EFFFE288
      Full thread dump:
          "AWT-Motif" (TID:0xee004c78, sys_thread_t:0xedf41db8, state:CW) prio=5
              java.lang.Thread.run(Thread.java)
          "AWT-Input" (TID:0xee004c98, sys_thread_t:0xedf71db8, state:CW) prio=5
          "AWT-EventQueue-0" (TID:0xee004cb0, sys_thread_t:0xedfa1db8, state:CW)
      prio=5
              java.lang.Object.wait(Object.java)
              java.awt.EventQueue.getNextEvent(EventQueue.java:119)
              java.awt.EventDispatchThread.run(EventDispatchThread.java:55)
          "Finalizer thread" (TID:0xee000220, sys_thread_t:0xef341db8, state:CW)
      prio=1
          "Async Garbage Collector" (TID:0xee000268, sys_thread_t:0xef371db8,
      state:R) prio=1
          "Idle thread" (TID:0xee0002b0, sys_thread_t:0xef471db8, state:R) prio=0
          "Clock" (TID:0xee000088, sys_thread_t:0xef541db8, state:CW) prio=12
          "main" (TID:0xee0000b0, sys_thread_t:0x334d0, state:R) prio=5 *current
      thread*
              java.lang.Runtime.loadLibrary(Runtime.java)
              java.lang.System.loadLibrary(System.java)
              ContentInfo.getLibrary(ContentInfo.java:72)
              MainMenu.getLibrary(MainMenu.java:108)
              MainMenu.main(MainMenu.java:680)
      Monitor Cache Dump:
          java.awt.EventQueue@EE004D00/EE351F98: <unowned>
              Waiting to be notified:
                  "AWT-EventQueue-0" (0xedfa1db8)
          <unknown key> (0xef371db8): owner "Async Garbage Collector" (0xef371db8, 1
      entry)
          java.lang.Runtime@EE003EA0/EE34EE50: owner "main" (0x334d0, 1 entry)
          sun.awt.motif.MToolkit@EE004A78/EE351EA8: <unowned>
              Waiting to be notified:
                  "AWT-Motif" (0xedf41db8)
      Registered Monitor Dump:
          Thread queue lock: <unowned>
          Name and type hash table lock: <unowned>
          String intern lock: <unowned>
          JNI pinning lock: <unowned>
          JNI global reference lock: <unowned>
          BinClass lock: <unowned>
          Class loading lock: <unowned>
          Java stack lock: <unowned>
          Code rewrite lock: <unowned>
          Heap lock: <unowned>
          Has finalization queue lock: <unowned>
          Finalize me queue lock: <unowned>
              Waiting to be notified:
                  "Finalizer thread" (0xef341db8)
          Monitor IO lock: <unowned>
          Child death monitor: <unowned>
          Event monitor: <unowned>
          I/O monitor: <unowned>
              Waiting to be notified:
                  "AWT-Input" (0xedf71db8)
          Alarm monitor: <unowned>
              Waiting to be notified:
                  "Clock" (0xef541db8)
          Sbrk lock: <unowned>
          Monitor registry: owner "main" (0x334d0, 1 entry)
      Thread Alarm Q:
          sys_thread_t 0xedf71db8 [Timeout in 231 ms]
      Abort(coredump)


      > BTW, are you using Java Workshop, wiht JDK 1.1.5 ? Which version of Java
      > Workshop ?
      >

      We bought Java Workshop 2.0 and I have used it to help find bugs, but not for
      writing and testing code directly. I have just today upgraded to 2.0a so I
      could use the Swing beans. I would also like to use JDK 1.1.6 with the Java
      Workshop but have not figured out how to configure it to run with that version,
      (staying with 1.1.3 for the moment). Our LAI component written in Java now uses
      JDK 1.1.6 which also encounters the segmentation violation. (Java Workshop is
      not used for production builds).

      > Again, this is happening on jdk1.1.5, right ?
      >

      It happens with both jdk 1.1.5. and 1.1.6

      > What is LAI ? I am ignorant about LAI. Can you pl describe, for my knowledge
      ?
      >

      The LAI is a mnemonic for Local Administrative Interface. It is a java program
      that allows an operator to monitor and control the operation of the Video on
      Demand system. The LAI communicates with other processes in the system (these
      are all written in C) using UDP, TCP and direct file reads. The LAI also uses
      several native code libraries to interact with the system.

      Core dumps are not available at this time. Requested the cust to provide
      this when it happens next time.

            never Tom Rodriguez
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: