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

OpenJDK8 crashes with -XX:+EnableTracing

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 8u172
    • Fix Version/s: None
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      svc
    • CPU:
      generic
    • OS:
      generic

      Description

      Reported by Xin Liu (xxinliu@amazon.com).

      If you invoke java with the option -XX:+EnableTracing, it will crash immediately. It's because events XXXFlagChanged doesn't work in the initial thread.

      class EventBooleanFlagChanged : public TraceEvent<EventBooleanFlagChanged>
        EventBooleanFlagChanged(EventStartTime timing=TIMED) : TraceEvent<EventBooleanFlagChanged>(timing) {}

        void writeEvent(void) {
          ResourceMark rm;
          if (UseLockedTracing) {
            ttyLocker lock;
            writeEventContent();
          } else {
            writeEventContent();
          }
        }
      };

      The ResourceMark won't work if Thread::current() is NULL.

      A simple patch for OpenJDK follows, but won't work for OracleJDK.

      diff --git a/src/hotspot/src/share/vm/runtime/globals.cpp b/src/hotspot/src/share/vm/runtime/globals.cpp
      index 310fc2ea..6f89c275 100644
      --- a/src/hotspot/src/share/vm/runtime/globals.cpp
      +++ b/src/hotspot/src/share/vm/runtime/globals.cpp
      @@ -608,12 +608,12 @@ bool CommandLineFlags::wasSetOnCmdline(const char* name, bool* value) {
       template<class E, class T>
       static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin)
       {
      - E e;
      - e.set_name(name);
      - e.set_old_value(old_value);
      - e.set_new_value(new_value);
      - e.set_origin(origin);
      - e.commit();
      + //E e;
      + //e.set_name(name);
      + //e.set_old_value(old_value);
      + //e.set_new_value(new_value);
      + //e.set_origin(origin);
      + //e.commit();
       }
       
       bool CommandLineFlags::boolAt(const char* name, size_t len, bool* value) {

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              phh Paul Hohensee
              Reporter:
              phh Paul Hohensee
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: