From f089d66b9e9018bccd4e3ed14a7a8f9676d920d8 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 5 Oct 2021 10:22:26 -0700 Subject: [PATCH 1/2] Use custom error message when running out of syncblocks Contributes to #49215 --- src/coreclr/dlls/mscorrc/mscorrc.rc | 1 + src/coreclr/dlls/mscorrc/resource.h | 1 + src/coreclr/vm/syncblk.cpp | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coreclr/dlls/mscorrc/mscorrc.rc b/src/coreclr/dlls/mscorrc/mscorrc.rc index 6a25003ccf2310..28cabf4fae5c86 100644 --- a/src/coreclr/dlls/mscorrc/mscorrc.rc +++ b/src/coreclr/dlls/mscorrc/mscorrc.rc @@ -495,6 +495,7 @@ BEGIN IDS_EE_ARRAY_DIMENSIONS_EXCEEDED "Array dimensions exceeded supported range." + IDS_EE_OUT_OF_SYNCBLOCKS "Internal limitation: too many SyncBlocks." IDS_EE_THREAD_NOTSTARTED "Thread has not been started." IDS_EE_STRING_TOOLONG "Marshaler restriction: Excessively long string." diff --git a/src/coreclr/dlls/mscorrc/resource.h b/src/coreclr/dlls/mscorrc/resource.h index bc7d05bade6ff4..755af627186315 100644 --- a/src/coreclr/dlls/mscorrc/resource.h +++ b/src/coreclr/dlls/mscorrc/resource.h @@ -369,6 +369,7 @@ #define IDS_EE_COMIMPORT_METHOD_NO_INTERFACE 0x1aab #define IDS_EE_OUT_OF_MEMORY_WITHIN_RANGE 0x1aac #define IDS_EE_ARRAY_DIMENSIONS_EXCEEDED 0x1aad +#define IDS_EE_OUT_OF_SYNCBLOCKS 0x1aae #define IDS_CLASSLOAD_MI_CANNOT_OVERRIDE 0x1ab3 #define IDS_CLASSLOAD_COLLECTIBLEFIXEDVTATTR 0x1ab6 diff --git a/src/coreclr/vm/syncblk.cpp b/src/coreclr/vm/syncblk.cpp index 1a2c9358bf1baa..b6e3f58bd21286 100644 --- a/src/coreclr/vm/syncblk.cpp +++ b/src/coreclr/vm/syncblk.cpp @@ -840,7 +840,7 @@ void SyncBlockCache::Grow() if (!(newSyncTableSize > m_SyncTableSize)) // Make sure we actually found room to grow! { - COMPlusThrowOM(); + EX_THROW(EEMessageException, (kOutOfMemoryException, IDS_EE_OUT_OF_SYNCBLOCKS)); } newSyncTable = new SyncTableEntry[newSyncTableSize]; From a3c2ac8203798a7a4027d507aefe3b89bd0bbf62 Mon Sep 17 00:00:00 2001 From: Manish Godse <61718172+mangod9@users.noreply.github.com> Date: Tue, 5 Oct 2021 12:01:21 -0700 Subject: [PATCH 2/2] Update src/coreclr/dlls/mscorrc/mscorrc.rc update message Co-authored-by: Jan Kotas --- src/coreclr/dlls/mscorrc/mscorrc.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/dlls/mscorrc/mscorrc.rc b/src/coreclr/dlls/mscorrc/mscorrc.rc index 28cabf4fae5c86..2dcd495c3fe619 100644 --- a/src/coreclr/dlls/mscorrc/mscorrc.rc +++ b/src/coreclr/dlls/mscorrc/mscorrc.rc @@ -495,7 +495,7 @@ BEGIN IDS_EE_ARRAY_DIMENSIONS_EXCEEDED "Array dimensions exceeded supported range." - IDS_EE_OUT_OF_SYNCBLOCKS "Internal limitation: too many SyncBlocks." + IDS_EE_OUT_OF_SYNCBLOCKS "Internal limitation: attempt to create more than 2^26 SyncBlocks." IDS_EE_THREAD_NOTSTARTED "Thread has not been started." IDS_EE_STRING_TOOLONG "Marshaler restriction: Excessively long string."