[11u] RFR JDK-8213231 ThreadSnapshot::_threadObj can become stale

Jiangli Zhou jianglizhou at google.com
Sun Mar 21 00:09:59 UTC 2021


Hello,

We recently noticed JDK-8213231 related GC crashes in production
environments when running on JDK 11. The crashes were always
associated with a stale pointer from a java.lang.management.ThreadInfo
object to a bad j.l.String object. Applying JDK-8213231's fix resolved
the specific crashes. I'd like to backport JDK-8213231 to JDK 11u.

Bug: https://bugs.openjdk.java.net/browse/JDK-8213231
Original commit: http://hg.openjdk.java.net/jdk/jdk/rev/391d671f222b
Webrev: http://cr.openjdk.java.net/~jiangli/backport-8213231/webrev.00/

The patch did not apply cleanly. The following diff in
threadService.hpp were hand merged:

--- threadService.hpp
+++ threadService.hpp
@@ -213,12 +213,15 @@
   ThreadConcurrentLocks* _concurrent_locks;
   ThreadSnapshot*        _next;

-public:
-  // Dummy snapshot
+  // ThreadSnapshot instances should only be created via
+  // ThreadDumpResult::add_thread_snapshot.
+  friend class ThreadDumpResult;
   ThreadSnapshot() : _thread(NULL), _threadObj(NULL),
                      _blocker_object(NULL), _blocker_object_owner(NULL),
                      _stack_trace(NULL), _concurrent_locks(NULL),
_next(NULL) {};
-  ThreadSnapshot(ThreadsList * t_list, JavaThread* thread);
+  void        initialize(ThreadsList * t_list, JavaThread* thread);
+
+public:
   ~ThreadSnapshot();

Testing: Linux x86_64 tier1 tests

Best,
Jiangli


More information about the jdk-updates-dev mailing list