diff options
author | Mathieu Chartier <mathieuc@google.com> | 2015-01-22 16:36:10 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2015-01-22 16:38:03 -0800 |
commit | 4936159997132d7706d9700c646f35ef0283df4b (patch) | |
tree | 5c46890e666b8d74baed83a6de6429e495c9e2a0 /runtime/monitor.cc | |
parent | 40d9c6a2339a1610764c0266061e3a6040e64726 (diff) | |
download | art-4936159997132d7706d9700c646f35ef0283df4b.tar.gz art-4936159997132d7706d9700c646f35ef0283df4b.tar.bz2 art-4936159997132d7706d9700c646f35ef0283df4b.zip |
Fix compaction unsafe DescribeWait
Fixes a crash that was seen once in automated tests, PrettyTypeOf
was accessing a stale object which had moved during IdentityHashCode
due to thin lock inflation causing suspension.
Change-Id: I105aa9a09d4e8c9091b9a60e508ef71e613f1eed
Diffstat (limited to 'runtime/monitor.cc')
-rw-r--r-- | runtime/monitor.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/monitor.cc b/runtime/monitor.cc index ef63080649..5e3338042c 100644 --- a/runtime/monitor.cc +++ b/runtime/monitor.cc @@ -933,8 +933,11 @@ void Monitor::DescribeWait(std::ostream& os, const Thread* thread) { PrettyTypeOf(pretty_object).c_str()); } else { // - waiting on <0x6008c468> (a java.lang.Class<java.lang.ref.ReferenceQueue>) + // Call PrettyTypeOf before IdentityHashCode since IdentityHashCode can cause thread + // suspension and move pretty_object. + const std::string pretty_type(PrettyTypeOf(pretty_object)); os << wait_message << StringPrintf("<0x%08x> (a %s)", pretty_object->IdentityHashCode(), - PrettyTypeOf(pretty_object).c_str()); + pretty_type.c_str()); } } // - waiting to lock <0x613f83d8> (a java.lang.Object) held by thread 5 |