runtime: Span CopyTo Span - Crashes .Net
There appears to be some sort of threading issue in the System.Memory 4.5.3 running on .Net Framework for the following code:
Memory<byte> memory = new byte[100];
ReadOnlySpan<byte> temp = new byte[30];
temp.CopyTo(memory.Span);
attached is a sample program that will crash the error:
The process was terminated due to an internal error in the .NET Runtime at IP 00007FFE09357BFD (00007FFE091A0000) with exit code 80131506.
category:correctness theme:gc-info skill-level:expert cost:medium
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (17 by maintainers)
Commits related to this issue
- work around for bug in Jitter / System.Memory See: https://github.com/dotnet/coreclr/issues/27590 — committed to abbotware/arrow-fork by abbotware 4 years ago
- Port of dotnet/runtime#1059 to 3.1 branch This is the fix for #27924. This is a GC hole bug that was found externally, #27590. The cause is that the JIT was using the target type of the subtract when... — committed to CarolEidt/coreclr by CarolEidt 4 years ago
I have checked in the fix for this issue into the Desktop .Net runtime for 4.8 and 4.7
The fix is expected to ship in the latter part of September as part of that month’s non security release. (barring any unexpected issues)
Thanks, I have a repro case and have tested the fix. It looks good
It can be worked around in System.Memory by avoiding the code pattern that hits the JIT bug.
https://github.com/dotnet/coreclr/issues/27924 is the root cause of this crash.