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

Windows native last error value cleared with -Xcomp or -Xint (but not neither)

    XMLWordPrintable

Details

    Description

      The native Windows last error value can be set and fetched using Panama native access, to call SetLastError and GetLastError. The value set should be available to be fetched again. GetLastError should usually be called "immediately" after e.g. an api call that may set it, so calling immediately after calling SetLastError seems reasonable.

      JDK-8292302 showed a problem under jdb, now resolved, where the last error value can be cleared/corrupted. This was a regression from previous behaviour.

      Testing for that fix shows that -Xcomp also clears the value, and this is reproducible before the change that caused 8292302.

      Running with -Xint also reproduces the problem of GetLastError not returning the value set with SetLastError, but takes longer.

      Running with neither -Xcomp or -Xint does not appear to reproduce the problem.

      Example test app attached:

      javac --release 20 --enable-preview GetLastErrorTest.java

      Normal success:
      java --enable-preview GetLastErrorTest
      ..truncated...
      .........ran for 5230230 ms


      Failure:

      java -Xcomp --enable-preview GetLastErrorTest
      (warnings removed)
      0
      java.lang.RuntimeException: GetLastError mismatch: 0 != wanted 42: failed.
      ran for 4530 ms


      java -Xint --enable-preview GetLastErrorTest
      ...truncated...
      .........................................................................................0
      java.lang.RuntimeException: GetLastError mismatch: 0 != wanted 42: failed.
      ran for 1542702 ms

      (that's failing in about 25 minutes, -Xcomp fails immediately)

      Attachments

        Issue Links

          Activity

            People

              kevinw Kevin Walls
              kevinw Kevin Walls
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: