Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Issue 2845053003: Fix asserts in StackFrameIterator which were effectively disabled (Closed)

Created:
3 years, 7 months ago by kustermann
Modified:
3 years, 7 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Fix asserts in StackFrameIterator which were effectively disabled The assertions which tried to assert that we only use StackFrameIterator to walk frames of the current thread was incorrect. We already have cases where other threads will walk the stack of the mutator thread, see below for an example where this can happen. Thread::VisitObjectPointers was incorrectly passing Thread::Current() to the StackFrameIterator instead of 'this'. (Code in thread_registry.cc will loop over a number of threads and calls VisitObjectPointers on them) Mutator thread: 0 pthread_cond_wait@@GLIBC_2.3.2 1 dart::Monitor::WaitMicros 2 dart::Monitor::Wait 3 dart::MonitorLocker::Wait 4 dart::ThreadBarrier::Sync 5 dart::GCMarker::MarkObjects 6 dart::PageSpace::MarkSweep 7 dart::Heap::CollectOldSpaceGarbage 8 dart::Heap::CollectNewSpaceGarbage 9 dart::Heap::CollectGarbage 10 dart::DN_HelperObject_<native> 11 dart::BootstrapNatives::<native> <dart frames> MarkTask thread: 1 dart::EntryFrame::VisitObjectPointers 2 dart::Thread::VisitObjectPointers <---- Walks mutator thread stack 3 dart::ThreadRegistry::VisitObjectPointers <---- Iterates over a number of threads 4 dart::Isolate::VisitStackPointers 5 dart::Isolate::VisitObjectPointers 6 dart::GCMarker::IterateRoots 7 dart::MarkTask::Run 8 dart::ThreadPool::Worker::Loop 9 dart::ThreadPool::Worker::Main 10 dart::ThreadStart R=rmacnak@google.com Committed: https://github.com/dart-lang/sdk/commit/ac8d2056a3f3dabb29a39c5181b56cf5a212c9b0

Patch Set 1 #

Patch Set 2 : make thread argument mandatory, pass in bool, add TODO(vm-team) to do it better #

Patch Set 3 : remote two assertions which cannot be made #

Total comments: 4

Patch Set 4 : Add StackFrameIterator::{ValidationPolicy,CrossThreadPolicy} enums #

Unified diffs Side-by-side diffs Delta from patch set Stats (+232 lines, -129 lines) Patch
M runtime/lib/errors.cc View 1 2 3 3 chunks +6 lines, -3 lines 0 comments Download
M runtime/lib/object.cc View 1 2 3 3 chunks +6 lines, -3 lines 0 comments Download
M runtime/lib/stacktrace.cc View 1 2 3 2 chunks +6 lines, -2 lines 0 comments Download
M runtime/vm/benchmark_test.cc View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M runtime/vm/debugger.cc View 1 2 3 9 chunks +27 lines, -9 lines 0 comments Download
M runtime/vm/deopt_instructions.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/exceptions.cc View 1 2 3 6 chunks +15 lines, -6 lines 0 comments Download
M runtime/vm/isolate_reload.cc View 1 2 3 2 chunks +5 lines, -2 lines 0 comments Download
M runtime/vm/native_entry.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/os.h View 1 chunk +0 lines, -4 lines 0 comments Download
M runtime/vm/os_android.cc View 1 chunk +0 lines, -5 lines 0 comments Download
M runtime/vm/os_fuchsia.cc View 1 chunk +0 lines, -6 lines 0 comments Download
M runtime/vm/os_linux.cc View 1 chunk +0 lines, -5 lines 0 comments Download
M runtime/vm/os_macos.cc View 1 chunk +0 lines, -5 lines 0 comments Download
M runtime/vm/os_win.cc View 1 chunk +0 lines, -5 lines 0 comments Download
M runtime/vm/profiler.cc View 1 2 3 1 chunk +9 lines, -1 line 0 comments Download
M runtime/vm/runtime_entry.cc View 1 2 3 20 chunks +40 lines, -20 lines 0 comments Download
M runtime/vm/simulator_arm.cc View 1 2 3 1 chunk +4 lines, -3 lines 0 comments Download
M runtime/vm/simulator_arm64.cc View 1 2 3 1 chunk +4 lines, -3 lines 0 comments Download
M runtime/vm/simulator_mips.cc View 1 2 3 1 chunk +4 lines, -3 lines 0 comments Download
M runtime/vm/stack_frame.h View 1 2 3 3 chunks +39 lines, -14 lines 0 comments Download
M runtime/vm/stack_frame.cc View 1 2 3 5 chunks +21 lines, -17 lines 0 comments Download
M runtime/vm/stack_frame_test.cc View 1 2 3 5 chunks +12 lines, -5 lines 0 comments Download
M runtime/vm/stack_trace.cc View 1 2 3 2 chunks +4 lines, -2 lines 0 comments Download
M runtime/vm/thread.cc View 1 2 3 1 chunk +19 lines, -1 line 0 comments Download
M runtime/vm/weak_code.cc View 1 2 3 2 chunks +4 lines, -2 lines 0 comments Download

Messages

Total messages: 11 (4 generated)
rmacnak
The exception for Windows is for the profiler, since there the thread interrupter is the ...
3 years, 7 months ago (2017-04-28 17:52:46 UTC) #2
kustermann
PTAL
3 years, 7 months ago (2017-05-01 15:12:22 UTC) #4
kustermann
PTAL
3 years, 7 months ago (2017-05-01 15:13:47 UTC) #5
rmacnak
LGTM https://codereview.chromium.org/2845053003/diff/40001/runtime/vm/debugger.cc File runtime/vm/debugger.cc (right): https://codereview.chromium.org/2845053003/diff/40001/runtime/vm/debugger.cc#newcode1168 runtime/vm/debugger.cc:1168: StackFrameIterator iterator(false, Thread::Current(), false); Here and elsewhere StackFrameIterator::kDontValidateFrames, ...
3 years, 7 months ago (2017-05-01 15:51:33 UTC) #6
Vyacheslav Egorov (Google)
Drive-by suggestion https://codereview.chromium.org/2845053003/diff/40001/runtime/lib/errors.cc File runtime/lib/errors.cc (right): https://codereview.chromium.org/2845053003/diff/40001/runtime/lib/errors.cc#newcode78 runtime/lib/errors.cc:78: DartFrameIterator iterator(thread, false); I suggest that this ...
3 years, 7 months ago (2017-05-01 15:54:38 UTC) #8
kustermann
https://codereview.chromium.org/2845053003/diff/40001/runtime/lib/errors.cc File runtime/lib/errors.cc (right): https://codereview.chromium.org/2845053003/diff/40001/runtime/lib/errors.cc#newcode78 runtime/lib/errors.cc:78: DartFrameIterator iterator(thread, false); On 2017/05/01 15:54:38, Vyacheslav Egorov (Google) ...
3 years, 7 months ago (2017-05-02 07:11:18 UTC) #9
kustermann
3 years, 7 months ago (2017-05-03 08:27:12 UTC) #11
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
ac8d2056a3f3dabb29a39c5181b56cf5a212c9b0 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698