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

Cannot use Structured Exception Handling on Windows x64 after JVMstarted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 5.0u5
    • hotspot
    • None
    • x86
    • windows_2003

      UGS (ISV) encounters a problem with using Structured Exception Handling on Windows x 64 after the JVM has started. This is their code:

      int ff() {
        __try {
            AA* b = 0;
            b->y = 16;
        }

        __except(1) {
            printf("Caught SEH exception\n");
        }

        return 0;
      }

      static void start_jvm();

      int main(int argc, char *argv[]) {
            ff();
            if ( argc >= 2 )
                start_jvm();
            ff();
            return 0;
      }

      start_jvm() calls JNI_CreateJavaVM()to start the JVM. The line “b->y =16” causes a Microsoft “Win32” exception to be thrown. The exception is supposed to be caught in the __except block. Before starting the JVM, the code works as expected, but after starting the JVM, the program crashes at the line “b->y = 16” with a HotSpot virtual machine dump.

      I’ve attached the complete code for the program that demonstrates the problem. Instructions for running the program:
      set JAVA_HOME=<java 1.5 home>
      set PATH=%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin\server;%path%
      nmake –f Makefile
      test_seh_java.exe

      # This verifies that the SEH exception is caught both times if the JVM is not started
      test_seh_java.exe a
      # The program crashes.

      They are using Microsoft Windows Server 2003, Standard x64 Edition, Service Pack 1 on a machine with a Dual Core AMD Opteron Processor 875. The java version is

      java version "1.5.0_04"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_04-b05, mixed mode)

      Note: this problem does not occur when running Windows with a 32-bit processor.

            ksrini Kumar Srinivasan
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: