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

[17u] guarantee(is_result_safe || is_in_asgct()) failed inside AsyncGetCallTrace

XMLWordPrintable

    • svc
    • In Review
    • generic
    • linux

      There are multiple bug reports against async-profiler and Datadog profiler referring to

      guarantee(is_result_safe || is_in_asgct()) failed: unsafe access to zombie method

      Examples:
      https://github.com/async-profiler/async-profiler/issues/1168
      https://github.com/DataDog/dd-trace-java/issues/7144

      is_in_asgct() returns false despite AsyncGetCallTrace being clearly visible on the stack trace:

      Current thread (0x00007ff7d4092870): JavaThread "I/O dispatcher 103" [_thread_in_Java, id=560, stack(0x00007ff7a14d5000,0x00007ff7a15d6000)]

      Stack: [0x00007ff7a14d5000,0x00007ff7a15d6000], sp=0x00007ff7a15d3830, free space=1018k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x5a6c04] CodeCache::find_blob(void*)+0xf4
      V [libjvm.so+0xe7928b] JavaThread::pd_get_top_frame(frame*, void*, bool)+0x16b
      V [libjvm.so+0x6c8526] AsyncGetCallTrace+0x176

      The bug appeared as a result of two conflicting backports:
      https://github.com/openjdk/jdk17u/commit/19639855311a and https://github.com/openjdk/jdk17u/commit/c2e274e8578427144294735dc06a2f92ffc7cbde

      Now, JavaThread has two `_in_asgct` fields: one is declared in Thread class, and another in JavaThread class. AsyncGetCallTrace sets the former field while the above guarantee checks the latter field.

            apangin Andrei Pangin
            apangin Andrei Pangin
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: