The Case of the Vector With an Impossibly Large Size -- Raymond Chen
In this software troubleshooting case, a customer experienced program crashes, and a detailed analysis of the code revealed several issues. The primary problem stemmed from lazy initialization of a widget list, leading to inconsistent vector states and potential crashes. Additionally, a multithreading issue was identified, highlighting the importance of thread-safety mechanisms in code that can be accessed concurrently.
The Case of the Vector With an Impossibly Large Size
by Raymond Chen
From the article:
A customer had a program that crashed with this stack:
contoso!Widget::GetCost contoso!StandardWidgets::get_TotalCost+0x12f rpcrt4!Invoke+0x73 rpcrt4!Ndr64StubWorker+0xb9b rpcrt4!NdrStubCall3+0xd7 combase!CStdStubBuffer_Invoke+0xdb combase!ObjectMethodExceptionHandlingAction<<lambda_...> >+0x47 combase!DefaultStubInvoke+0x376 combase!ServerCall::ContextInvoke+0x6f3 combase!ComInvokeWithLockAndIPID+0xacb combase!ThreadInvoke+0x103 rpcrt4!DispatchToStubInCNoAvrf+0x18 rpcrt4!RPC_INTERFACE::DispatchToStubWorker+0x1a9 rpcrt4!RPC_INTERFACE::DispatchToStubWithObject+0x1a7 rpcrt4!LRPC_SCALL::DispatchRequest+0x308 rpcrt4!LRPC_SCALL::HandleRequest+0xdcb rpcrt4!LRPC_SASSOCIATION::HandleRequest+0x2c3 rpcrt4!LRPC_ADDRESS::HandleRequest+0x183 rpcrt4!LRPC_ADDRESS::ProcessIO+0x939 rpcrt4!LrpcIoComplete+0xff ntdll!TppAlpcpExecuteCallback+0x14d ntdll!TppWorkerThread+0x4b4 kernel32!BaseThreadInitThunk+0x18 ntdll!RtlUserThreadStart+0x21They wondered if some recent change to Windows was the source of the problem, since it didn’t happen as much in earlier versions of Windows.