Fix VS4Mac crash report and core dump generation perf problems (#60319)
authorMike McLaughlin <mikem@microsoft.com>
Thu, 14 Oct 2021 19:08:26 +0000 (12:08 -0700)
committerGitHub <noreply@github.com>
Thu, 14 Oct 2021 19:08:26 +0000 (12:08 -0700)
commit892555a19b8b815f64406c7f9b4c44ec89cefaf7
tree095603ea06de444dc30a8bf8bc9257dae9544c9f
parent89123cb04d8de23faa6d5a92851de48d2c181d47
Fix VS4Mac crash report and core dump generation perf problems (#60319)

This is a VS4Mac show stopper. The performance (4 min or so) of taking a core dump
when VS4Mac crashes or hangs is unacceptable.

Backport of #60205

Refactor the DAC enumerate memory region phase out of gather crash info

This is so the crash report json is written and available before the core
dump which for VS4Mac currently takes 4 minutes.

Since on both Linux and MacOS all the RW regions have been already added
by createdump itself for heap dumps, then the sometimes slow (4 minutes for
VS4Mac) heap enum memory region is changed to the faster normal one. It adds
necessary DAC globals, etc. without the costly assembly, module, class, type
runtime data structure enumeration.

This fast heap dumps is opt'ed in with COMPlus_DbgEnableFastHeapDumps=1 env var to mitigate the
risk of something missing from these dumps.

Tested creating a crash report/core dump against VS4Mac process. Ran all the SOS tests on MacOS and Linux against this change.

Low since there is an opt-in env var that enables the most risk part.
src/coreclr/debug/createdump/crashinfo.cpp
src/coreclr/debug/createdump/crashinfo.h
src/coreclr/debug/createdump/createdumpunix.cpp
src/coreclr/debug/daccess/enummem.cpp
src/coreclr/debug/daccess/request_svr.cpp