Skip to content

Commit c481b3c

Browse files
committed
Extra OOM crash buckets.
It could be useful for the analysis purposes to know whether the state at the time of the crash was visible or not visible, if known.
1 parent 72719d8 commit c481b3c

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed

lib/Common/Exceptions/ReportError.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,48 @@ _NOINLINE void OutOfMemoryAllocationPolicy_unrecoverable_error()
181181
ReportFatalException(NULL, E_OUTOFMEMORY, Fatal_OutOfMemory, scenario);
182182
}
183183

184+
///////
185+
//
186+
// The following variety of OOM unrecoverable errors are similar to the ones above
187+
// and exist specifically for additional distinct bucketing of crash dumps for
188+
// diagnostics purposes.
189+
//
190+
///////
191+
192+
_NOINLINE void OutOfMemoryTooManyPinnedObjects_unrecoverable_error_visible()
193+
{
194+
int scenario = 15;
195+
ReportFatalException(NULL, E_OUTOFMEMORY, Fatal_OutOfMemory, scenario);
196+
}
197+
198+
_NOINLINE void OutOfMemoryTooManyClosedContexts_unrecoverable_error_visible()
199+
{
200+
int scenario = 16;
201+
ReportFatalException(NULL, E_OUTOFMEMORY, Fatal_OutOfMemory, scenario);
202+
}
203+
204+
_NOINLINE void OutOfMemoryAllocationPolicy_unrecoverable_error_visible()
205+
{
206+
int scenario = 17;
207+
ReportFatalException(NULL, E_OUTOFMEMORY, Fatal_OutOfMemory, scenario);
208+
}
209+
210+
_NOINLINE void OutOfMemoryTooManyPinnedObjects_unrecoverable_error_notvisible()
211+
{
212+
int scenario = 18;
213+
ReportFatalException(NULL, E_OUTOFMEMORY, Fatal_OutOfMemory, scenario);
214+
}
215+
216+
_NOINLINE void OutOfMemoryTooManyClosedContexts_unrecoverable_error_notvisible()
217+
{
218+
int scenario = 19;
219+
ReportFatalException(NULL, E_OUTOFMEMORY, Fatal_OutOfMemory, scenario);
220+
}
221+
222+
_NOINLINE void OutOfMemoryAllocationPolicy_unrecoverable_error_notvisible()
223+
{
224+
int scenario = 20;
225+
ReportFatalException(NULL, E_OUTOFMEMORY, Fatal_OutOfMemory, scenario);
226+
}
227+
184228
#pragma optimize("",on)

lib/Common/Exceptions/ReportError.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,67 @@ void RpcFailure_unrecoverable_error(HRESULT hr);
7676
void OutOfMemory_unrecoverable_error();
7777
void RecyclerSingleAllocationLimit_unrecoverable_error();
7878
void MemGCSingleAllocationLimit_unrecoverable_error();
79+
7980
void OutOfMemoryTooManyPinnedObjects_unrecoverable_error();
8081
void OutOfMemoryTooManyClosedContexts_unrecoverable_error();
8182
void OutOfMemoryAllocationPolicy_unrecoverable_error();
8283

84+
void OutOfMemoryTooManyPinnedObjects_unrecoverable_error_visible();
85+
void OutOfMemoryTooManyClosedContexts_unrecoverable_error_visible();
86+
void OutOfMemoryAllocationPolicy_unrecoverable_error_visible();
87+
88+
void OutOfMemoryTooManyPinnedObjects_unrecoverable_error_notvisible();
89+
void OutOfMemoryTooManyClosedContexts_unrecoverable_error_notvisible();
90+
void OutOfMemoryAllocationPolicy_unrecoverable_error_notvisible();
91+
92+
inline void OutOfMemoryTooManyPinnedObjects_unrecoverable_error(BYTE visibility)
93+
{
94+
switch (visibility)
95+
{
96+
case 1:
97+
OutOfMemoryTooManyPinnedObjects_unrecoverable_error_visible();
98+
break;
99+
case 2:
100+
OutOfMemoryTooManyPinnedObjects_unrecoverable_error_notvisible();
101+
break;
102+
default:
103+
OutOfMemoryTooManyPinnedObjects_unrecoverable_error();
104+
break;
105+
}
106+
}
107+
108+
inline void OutOfMemoryTooManyClosedContexts_unrecoverable_error(BYTE visibility)
109+
{
110+
switch (visibility)
111+
{
112+
case 1:
113+
OutOfMemoryTooManyClosedContexts_unrecoverable_error_visible();
114+
break;
115+
case 2:
116+
OutOfMemoryTooManyClosedContexts_unrecoverable_error_notvisible();
117+
break;
118+
default:
119+
OutOfMemoryTooManyClosedContexts_unrecoverable_error();
120+
break;
121+
}
122+
}
123+
124+
inline void OutOfMemoryAllocationPolicy_unrecoverable_error(BYTE visibility)
125+
{
126+
switch (visibility)
127+
{
128+
case 1:
129+
OutOfMemoryAllocationPolicy_unrecoverable_error_visible();
130+
break;
131+
case 2:
132+
OutOfMemoryAllocationPolicy_unrecoverable_error_notvisible();
133+
break;
134+
default:
135+
OutOfMemoryAllocationPolicy_unrecoverable_error();
136+
break;
137+
}
138+
}
139+
83140
#ifndef DISABLE_SEH
84141
// RtlReportException is available on Vista and up, but we cannot use it for OOB release.
85142
// Use UnhandleExceptionFilter to let the default handler handles it.

lib/Runtime/Base/ThreadContext.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ ThreadContext::ThreadContext(AllocationPolicyManager * allocationPolicyManager,
213213
, reentrancySafeOrHandled(false)
214214
, isInReentrancySafeRegion(false)
215215
, closedScriptContextCount(0)
216+
, visibilityState(VisibilityState::Undefined)
216217
{
217218
pendingProjectionContextCloseList = JsUtil::List<IProjectionContext*, ArenaAllocator>::New(GetThreadAlloc());
218219
hostScriptContextStack = Anew(GetThreadAlloc(), JsUtil::Stack<HostScriptContext*>, GetThreadAlloc());

lib/Runtime/Base/ThreadContext.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,16 @@ class ThreadContext sealed :
866866
// high number may indicate that context leaks have occured.
867867
uint closedScriptContextCount;
868868

869+
enum VisibilityState : BYTE
870+
{
871+
Undefined = 0,
872+
Visible = 1,
873+
NotVisible = 2
874+
};
875+
876+
// indicates the visibility state of the hosting application/window/tab if known.
877+
VisibilityState visibilityState;
878+
869879
#if ENABLE_NATIVE_CODEGEN
870880
PreReservedVirtualAllocWrapper * GetPreReservedVirtualAllocator() { return &preReservedVirtualAllocator; }
871881
#if DYNAMIC_INTERPRETER_THUNK || defined(ASMJS_PLAT)

0 commit comments

Comments
 (0)