From 315557dde6a6dea05d9a2f869cf0826317914a13 Mon Sep 17 00:00:00 2001 From: Edwin Smith Date: Tue, 11 Apr 2017 07:20:10 -0700 Subject: [PATCH] Ignore captured frame after AFWH finishes Summary: When an async function finishes (returns a value or propagates an exception), it's frame is destroyed. however the WH object may live longer, and in the mean time any pointers in the frame should be considered dead even though they aren't nulled out. Reviewed By: ricklavoie Differential Revision: D4843710 fbshipit-source-id: b2cbdd0d548bdc5acea784ee940f01298d366f38 --- hphp/runtime/base/heap-scan.h | 6 ++++-- hphp/runtime/base/memory-manager.cpp | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hphp/runtime/base/heap-scan.h b/hphp/runtime/base/heap-scan.h index 19786bac55c..a7e2baefecf 100644 --- a/hphp/runtime/base/heap-scan.h +++ b/hphp/runtime/base/heap-scan.h @@ -86,8 +86,10 @@ inline void scanAFWH(const c_WaitHandle* wh, type_scan::Scanner& scanner) { assert(!wh->getAttribute(ObjectData::HasNativeData)); // scan ResumableHeader before object auto r = Resumable::FromObj(wh); - scanFrameSlots(r->actRec(), scanner); - scanner.scan(*r); + if (!wh->isFinished()) { + scanFrameSlots(r->actRec(), scanner); + scanner.scan(*r); + } return wh->scan(scanner); } diff --git a/hphp/runtime/base/memory-manager.cpp b/hphp/runtime/base/memory-manager.cpp index d64c4247374..af3802a1357 100644 --- a/hphp/runtime/base/memory-manager.cpp +++ b/hphp/runtime/base/memory-manager.cpp @@ -482,7 +482,10 @@ void MemoryManager::resetAllocator() { m_heap.reset(); // zero out freelists - for (auto& i : m_freelists) i.head = nullptr; + for (auto& list : m_freelists) list.head = nullptr; + if (RuntimeOption::EvalQuarantine) { + for (auto& list : m_quarantine) list.head = nullptr; + } m_front = m_limit = 0; tl_sweeping = false; m_exiting = false; -- 2.11.4.GIT