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

Decouple VMError::_id from Unix signals and Windows SEH codes.

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 10
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:
      None

      Description


      From review comments:
      http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2018-January/026024.html

      VMError::_id is defined as:

        static int _id; // Solaris/Linux signals: 0 - SIGRTMAX
                                              // Windows exceptions: 0xCxxxxxxx system errors
                                              // 0x8xxxxxxx system warnings
                           
      And used in “debug.hpp" we have:

        enum VMErrorType {
          INTERNAL_ERROR = 0xe0000000,
          OOM_MALLOC_ERROR = 0xe0000001,
          OOM_MMAP_ERROR = 0xe0000002
        };

      With “VMErrorType” being of type “unsigned int”, but in “vmError.hpp” we have:

        class VMError : public AllStatic {
        ...
          static int _id;
        ...

      Some explanation and comments from [~stuefe]:

      They look Windows-ish, like someone wanted them to mimic SEH codes - like
       someone took them directly from the examples here:
             https://msdn.microsoft.com/en-us/library/het71c37.aspx.

       They bothered us for some reason I do not really remember anymore, so in
       our port they long have had different values, with no adverse effects.

        enum ErrorType {
          // internal_error are errors which are not crashes - have no
          // associated signal number or exception id.
          internal_error = 0xffffffffe0000000ULL,
          oom_error = 0xffffffffe0000001ULL,
        };

      So, we extended them to 64bit and made the corresponding _id field 64bit unsigned. I think the reason was that we had clashes with third party DLLs using these SEH codes. So I just extended them to 64bit to avoid clashes with any possible Windows SEH codes.

      But I do not particularly like this approach now. A cleaner fix would be to separate signal number resp. SEH code from our own error id like this:

        enum ErrorType {
          // Crash. See _signo for signal number / SEH code.
          crash = 1,
          // internal_error are errors which are not crashes - have no
          // associated signal number or exception id.
          internal_error = 2
          oom_error = 3
          ...
        };

      and have a second member like _signo to hold the signal number on Linux, SEH code on Windows. Ideally that one should be unsigned 32bit to hold both worlds (int signals and DWORD SEH codes).

      That way we do not have to think about intersecting value ranges of _id. What do you think?

        Attachments

          Activity

            People

            Assignee:
            stuefe Thomas Stuefe
            Reporter:
            coleenp Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: