Skip to content

Access Violation Exception from UnpackToRgbPlanesAvx2Reduce #3247

Open

Description

@sandorkerekes

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

ImageSharp version

3.1.12

Other ImageSharp packages and versions

SixLabors.ImageSharp.Web 3.1.4 (via Umbraco.Cms 13)

Environment (Operating system, version and so on)

Azure App Service (Windows), Umbraco 13

.NET Framework version

8

Description

Hi there,

We're hitting this on ImageSharp 3.1.12 in production (Umbraco 13, ImageSharp.Web, Azure App Service, .NET 8) — same UnpackToRgbPlanesAvx2Reduce frame, fatal process crash. The backport in #3106 is merged to release/3.1.x but there's no 3.1.13 on NuGet. Umbraco (all versions, incl. 18) pins ImageSharp to 3.1.x, so we can't move to 4.x. Any chance of a 3.1.13 release?

Occurs intermittently in production on image resize (cache miss only).
No deterministic local repro — crash is in the AVX2 path during JPEG encode.

`

Your app crashed because of System.ExecutionEngineExceptionYour app, phil-web-prd, crashed because of System.ExecutionEngineException and aborted the requests it was processing when the overflow occurred. As a result, your app’s users may have experienced HTTP 502 errors.This call stack caused the exception: InlinedCallFrameSixLabors.ImageSharp.SimdUtils+HwIntrinsics.UnpackToRgbPlanesAvx2ReduceSixLabors.ImageSharp.PixelFormats.Rgb24+PixelOperations.UnpackIntoRgbPlanesSixLabors.ImageSharp.Formats.Jpeg.Components.Encoder.SpectralConverter`1[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]].ConvertStrideSixLabors.ImageSharp.Formats.Jpeg.Components.Encoder.SpectralConverter`1[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]].ConvertFullSixLabors.ImageSharp.Formats.Jpeg.JpegEncoderCore.WriteHuffmanScans[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]SixLabors.ImageSharp.Formats.Jpeg.JpegEncoderCore.Encode[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]SixLabors.ImageSharp.Formats.Jpeg.JpegEncoder.Encode[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]SixLabors.ImageSharp.Formats.ImageEncoder.EncodeWithSeekableStream[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]SixLabors.ImageSharp.Formats.ImageEncoder.Encode[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]SixLabors.ImageSharp.Image+EncodeVisitor.Visit[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]SixLabors.ImageSharp.Image`1[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]].AcceptSixLabors.ImageSharp.Advanced.AdvancedImageExtensions.AcceptVisitorSixLabors.ImageSharp.Image.SaveSixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware+d__21.MoveNextSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult System.Private.CoreLib][SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware+d__21 SixLabors.ImageSharp.Web]].ExecutionContextCallbackSystem.Threading.ExecutionContext.RunInternalSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult System.Private.CoreLib][SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware+d__21 SixLabors.ImageSharp.Web]].MoveNextSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult System.Private.CoreLib][SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware+d__21 SixLabors.ImageSharp.Web]].MoveNextSystem.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleActionSystem.Threading.Tasks.Task.RunContinuationsSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon System.Private.CoreLib]].SetExistingTaskResultSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon System.Private.CoreLib]].SetResultSixLabors.ImageSharp.Web.FormattedImage+d__16.MoveNextSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Web.FormattedImage+d__16 SixLabors.ImageSharp.Web]].ExecutionContextCallbackSystem.Threading.ExecutionContext.RunInternalSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Web.FormattedImage+d__16 SixLabors.ImageSharp.Web]].MoveNextSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Web.FormattedImage+d__16 SixLabors.ImageSharp.Web]].MoveNextSystem.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleActionSystem.Threading.Tasks.Task.RunContinuationsSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon System.Private.CoreLib]].SetExistingTaskResultSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon System.Private.CoreLib]].SetResultSixLabors.ImageSharp.Image+d__88`1[[System.__Canon System.Private.CoreLib]].MoveNextSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Image+d__88`1[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].ExecutionContextCallbackSystem.Threading.ExecutionContext.RunInternalSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Image+d__88`1[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].MoveNextSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Image+d__88`1[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].MoveNextSystem.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleActionSystem.Threading.Tasks.Task.RunContinuationsSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon System.Private.CoreLib]].SetExistingTaskResultSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon System.Private.CoreLib]].SetResultSixLabors.ImageSharp.Formats.ImageDecoder+d__3.MoveNextSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__3 SixLabors.ImageSharp]].ExecutionContextCallbackSystem.Threading.ExecutionContext.RunInternalSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__3 SixLabors.ImageSharp]].MoveNextSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__3 SixLabors.ImageSharp]].MoveNextSystem.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleActionSystem.Threading.Tasks.Task.RunContinuationsSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon System.Private.CoreLib]].SetExistingTaskResultSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon System.Private.CoreLib]].SetResultSixLabors.ImageSharp.Formats.ImageDecoder+d__13`1[[System.__Canon System.Private.CoreLib]].MoveNextSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__13`1[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].ExecutionContextCallbackSystem.Threading.ExecutionContext.RunInternalSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__13`1[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].MoveNextSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__13`1[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].MoveNextSystem.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleActionSystem.Threading.Tasks.Task.RunContinuationsSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Threading.Tasks.VoidTaskResult System.Private.CoreLib]].SetExistingTaskResultSystem.IO.Stream+d.MoveNextSystem.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult System.Private.CoreLib][System.IO.Stream+d System.Private.CoreLib]].ExecutionContextCallback To learn more about this exception, use the Kudu console to view the log file in d:\home\logfiles\crashdumps, which contains up to 10 log files for your app if space is available. --
Your app crashed because of System.ExecutionEngineException Your app, phil-web-prd, crashed because of System.ExecutionEngineException and aborted the requests it was processing when the overflow occurred. As a result, your app’s users may have experienced HTTP 502 errors.

This call stack caused the exception:

InlinedCallFrame
SixLabors.ImageSharp.SimdUtils+HwIntrinsics.UnpackToRgbPlanesAvx2Reduce
SixLabors.ImageSharp.PixelFormats.Rgb24+PixelOperations.UnpackIntoRgbPlanes
SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder.SpectralConverter1[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]].ConvertStride SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder.SpectralConverter1[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]].ConvertFull
SixLabors.ImageSharp.Formats.Jpeg.JpegEncoderCore.WriteHuffmanScans[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]
SixLabors.ImageSharp.Formats.Jpeg.JpegEncoderCore.Encode[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]
SixLabors.ImageSharp.Formats.Jpeg.JpegEncoder.Encode[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]
SixLabors.ImageSharp.Formats.ImageEncoder.EncodeWithSeekableStream[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]
SixLabors.ImageSharp.Formats.ImageEncoder.Encode[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]
SixLabors.ImageSharp.Image+EncodeVisitor.Visit[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]]
SixLabors.ImageSharp.Image1[[SixLabors.ImageSharp.PixelFormats.Rgb24 SixLabors.ImageSharp]].Accept SixLabors.ImageSharp.Advanced.AdvancedImageExtensions.AcceptVisitor SixLabors.ImageSharp.Image.Save SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware+d__21.MoveNext System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.Threading.Tasks.VoidTaskResult System.Private.CoreLib][SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware+d__21 [SixLabors.ImageSharp.Web](http://sixlabors.imagesharp.web/)]].ExecutionContextCallback System.Threading.ExecutionContext.RunInternal System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.Threading.Tasks.VoidTaskResult System.Private.CoreLib][SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware+d__21 [SixLabors.ImageSharp.Web](http://sixlabors.imagesharp.web/)]].MoveNext System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.Threading.Tasks.VoidTaskResult System.Private.CoreLib][SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware+d__21 [SixLabors.ImageSharp.Web](http://sixlabors.imagesharp.web/)]].MoveNext System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction System.Threading.Tasks.Task.RunContinuations System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon System.Private.CoreLib]].SetExistingTaskResult
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon System.Private.CoreLib]].SetResult SixLabors.ImageSharp.Web.FormattedImage+d__16.MoveNext System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Web.FormattedImage+d__16 [SixLabors.ImageSharp.Web](http://sixlabors.imagesharp.web/)]].ExecutionContextCallback System.Threading.ExecutionContext.RunInternal System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Web.FormattedImage+d__16 [SixLabors.ImageSharp.Web](http://sixlabors.imagesharp.web/)]].MoveNext System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Web.FormattedImage+d__16 [SixLabors.ImageSharp.Web](http://sixlabors.imagesharp.web/)]].MoveNext System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction System.Threading.Tasks.Task.RunContinuations System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon System.Private.CoreLib]].SetExistingTaskResult
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon System.Private.CoreLib]].SetResult SixLabors.ImageSharp.Image+d__881[[System.__Canon System.Private.CoreLib]].MoveNext
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Image+d__881[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].ExecutionContextCallback System.Threading.ExecutionContext.RunInternal System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Image+d__881[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].MoveNext
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Image+d__881[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].MoveNext System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction System.Threading.Tasks.Task.RunContinuations System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon System.Private.CoreLib]].SetExistingTaskResult
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon System.Private.CoreLib]].SetResult SixLabors.ImageSharp.Formats.ImageDecoder+d__3.MoveNext System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__3 SixLabors.ImageSharp]].ExecutionContextCallback System.Threading.ExecutionContext.RunInternal System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__3 SixLabors.ImageSharp]].MoveNext System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__3 SixLabors.ImageSharp]].MoveNext System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction System.Threading.Tasks.Task.RunContinuations System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon System.Private.CoreLib]].SetExistingTaskResult
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon System.Private.CoreLib]].SetResult SixLabors.ImageSharp.Formats.ImageDecoder+d__131[[System.__Canon System.Private.CoreLib]].MoveNext
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__131[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].ExecutionContextCallback System.Threading.ExecutionContext.RunInternal System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__131[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].MoveNext
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.__Canon System.Private.CoreLib][SixLabors.ImageSharp.Formats.ImageDecoder+d__131[[System.__Canon System.Private.CoreLib]] SixLabors.ImageSharp]].MoveNext System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction System.Threading.Tasks.Task.RunContinuations System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.Threading.Tasks.VoidTaskResult System.Private.CoreLib]].SetExistingTaskResult
System.IO.Stream+<g__Core
27_0>d.MoveNext
System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1[[System.Threading.Tasks.VoidTaskResult System.Private.CoreLib][System.IO.Stream+<g__Core
27_0>d System.Private.CoreLib]].ExecutionContextCallback

To learn more about this exception, use the Kudu console to view the log file in d:\home\logfiles\crashdumps, which contains up to 10 log files for your app if space is available.

We recommend that you fix your app code to prevent the System.ExecutionEngineException from occurring again. If you need more information to identify the cause of the crash, enable crash monitoring for your app.

Visit the Azure portal to get troubleshooting recommendations for your app.`

Steps to Reproduce

#3104

Images

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions