runtime: Assert failure: m_alignpad == 0 in libraries tests
Hit in https://github.com/dotnet/runtime/pull/70226
Stacktrace:
coreclr!DbgAssertDialog+0x1af [D:\a\_work\1\s\src\coreclr\utilcode\debug.cpp @ 594]
coreclr!ObjHeader::IllegalAlignPad+0x33 [D:\a\_work\1\s\src\coreclr\vm\syncblk.cpp @ 2952]
coreclr!ObjHeader::GetBits+0x41 [D:\a\_work\1\s\src\coreclr\vm\syncblk.h @ 1545]
coreclr!ObjHeader::Validate+0x50 [D:\a\_work\1\s\src\coreclr\vm\syncblk.cpp @ 2042]
coreclr!Object::ValidateInner+0x493 [D:\a\_work\1\s\src\coreclr\vm\object.cpp @ 581]
coreclr!Object::Validate+0xa1 [D:\a\_work\1\s\src\coreclr\vm\object.cpp @ 498]
coreclr!OBJECTREF::operator->+0x21 [D:\a\_work\1\s\src\coreclr\vm\object.cpp @ 1242]
coreclr!MarshalNative::GCHandleInternalAlloc+0x171 [D:\a\_work\1\s\src\coreclr\vm\marshalnative.cpp @ 492]
System_Private_CoreLib!System.ReadOnlyMemory`1[[System.Byte, System.Private.CoreLib]].Pin()+0xffffffff`a4114a41
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 28 (28 by maintainers)
@Maoni0 has a fix already. I also found a reasonably frequent repro last week - the readytorun\coreroot_determinism\coreroot_determinism coreclr test and run it with her fix over the weekend. Before the fix, it reproed about every 80 iterations. With the fix, 1000 iterations have passed without any repro.
@Maoni0 @janvorli A sort of “stable” repro on Windows-x64:
^ eventually fails with:
I also observe the behaviour @jkotas noticed that m_alignpad is quickly cleared, I even put multiple
if (m_alignpad != 0) {
checks thereThis assert can be hit for many different GC holes, GC heap corruptions and GC bugs. It is important to at least capture the stacktrace where the assert is hit, and track different stack traces by separate issues.
I think it is unlikely that the Linux arm crash you have seen is same root cause as this issue. I expect that it is going to have a different stacktrace. Unfortunately, we cannot tell for sure since no dump was collected.
I am closing this as non-actionable. If you see a test failing with this assert, do not re-activate this issue. Instead open a new issue and capture stack trace where the assert is hit in the issue description.
Thank you very much, @EgorBo! Based on your list of instructions, I was able to fairly quickly repro the assertion failure on my Windows desktop and have confirmed that after:
the assertion failure doesn’t occur based on running the tests overnight.
The main question I had was: how do I find out which test did the assertion failure occur for?
Right now, I get a pretty general message that there was an assertion failure for a System.Collections.Test but no indication as to which test it failed on:
If we know the exact test, we’ll have a quicker repro with a more targeted run.
@mrsharm in my repro you can append
-verbose
after-notrait category=failing
and xunit will print test names I think it were diffrient tests each run and I wasn’t able to reproduce the issue when I was asking xunit to run just one test specifically (via-method xx
)and thanks @EgorBo for finding another test that repros consistently.
note: doesn’t repro when I change optimization level from
-O2
to-O0
forcee_wks_core
(Checked config)We run of libraries tests with checked coreclr on Windows in windows.10.amd64.open.rt queue only. I do not see any other queues running this combination on Windows.
Here is a query you can use to find all libraries tests that failed with runtime asserts in last 10 days. (Some of these failed with a different assert.)
https://dataexplorer.azure.com/clusters/engsrvprod/databases/engineeringdata