Skip to content

Commit bb8eb71

Browse files
committed
[MERGE #5398 @atulkatti] MSFT:18075741 Fail fast if the concurrent threads are not shutdown when Recycler is deleted.
Merge pull request #5398 from atulkatti:Bug18075741.DeleteRecyclerFailFast.1 We haven't seen this happen in the wild. But JSHost Fuzzing tools are hitting this pretty often. It seems the fuzzer is using test flavor. Converting these asserts to fail fast to help with the investigation.
2 parents 7371703 + 8bbfdc7 commit bb8eb71

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

lib/Common/Memory/Recycler.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ class JavascriptThreadService;
3131
struct RecyclerMemoryData;
3232
#endif
3333

34-
#if DBG
3534
class ThreadContext;
36-
#endif
3735

3836
namespace Memory
3937
{
@@ -535,9 +533,7 @@ struct CollectionParam
535533
#if ENABLE_CONCURRENT_GC
536534
class RecyclerParallelThread
537535
{
538-
#if DBG
539536
friend class ThreadContext;
540-
#endif
541537

542538
public:
543539
typedef void (Recycler::* WorkFunc)();
@@ -1808,9 +1804,8 @@ class Recycler
18081804
friend class HeapInfo;
18091805
friend class HeapInfoManager;
18101806
friend class LargeHeapBucket;
1811-
#if DBG
18121807
friend class ThreadContext;
1813-
#endif
1808+
18141809
template <typename TBlockType>
18151810
friend class HeapBucketT;
18161811
template <typename TBlockType>

lib/Runtime/Base/ThreadContext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,9 @@ ThreadContext::~ThreadContext()
527527
Assert(this->debugManager == nullptr);
528528
#endif
529529

530-
#if DBG && ENABLE_CONCURRENT_GC && defined(_WIN32)
531-
AssertMsg(recycler->concurrentThread == NULL, "Recycler background thread should have been shutdown before destroying Recycler.");
532-
AssertMsg((recycler->parallelThread1.concurrentThread == NULL) && (recycler->parallelThread2.concurrentThread == NULL), "Recycler parallelThread(s) should have been shutdown before destroying Recycler.");
530+
#if ENABLE_CONCURRENT_GC && defined(_WIN32)
531+
AssertOrFailFastMsg(recycler->concurrentThread == NULL, "Recycler background thread should have been shutdown before destroying Recycler.");
532+
AssertOrFailFastMsg((recycler->parallelThread1.concurrentThread == NULL) && (recycler->parallelThread2.concurrentThread == NULL), "Recycler parallelThread(s) should have been shutdown before destroying Recycler.");
533533
#endif
534534

535535
HeapDelete(recycler);

0 commit comments

Comments
 (0)