Rank: Newbie Groups: Member
Joined: 4/10/2026 Posts: 2
|
Hello EO Support Team,
We are encountering a recurring System.OutOfMemoryException thrown internally by EO.WebEngine.Engine.Start() during HTML‑to‑PDF conversion. Once this occurs, the EO Documents/WebEngine becomes unusable within the running process. All subsequent HTML‑to‑PDF conversions fail, including very small, single‑page HTML documents.
Observed Error: Exception of type 'System.OutOfMemoryException' was thrown. InnerException: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at EO.Internal.gexv.iohz() at EO.Internal.gexv.upuw(String& ntl, Int32& ntm) at EO.Internal.gext.gyye.iscw(mnyu nsv, gexv nsw) at EO.Internal.gext.gyye.iscl(Type[] nsk, gexv[]& nsl) at EO.Internal.gext.egfn(Boolean& nnv, Type[] nnw, String nnx, String nny) at EO.Internal.gext.lorg(Type[] nns, String nnt, String nnu) at EO.Internal.gexu.lorg(String nti, String ntj) at EO.Internal.dqsv.frex() at EO.Internal.dqsv.rnpj.akvh() at EO.Internal.geti.hwrc(Action lvb) at EO.Internal.dqsv.ymox(WindowsIdentity hi) at EO.WebEngine.Engine.Start(WindowsIdentity user) at EO.WebEngine.Engine.Start() at EO.Internal.guhg.uron()
at System.Environment.get_StackTrace() at EO.Base.BaseException..ctor(String lte, Exception ltf) at EO.Pdf.HtmlToPdfException..ctor(HtmlToPdfErrorCode acx, Int32 acy, String acz, Exception ada) at EO.Pdf.HtmlToPdfException.akcd(Exception adc, String add) at EO.Internal.guhg.uron() at EO.Internal.guhh.uron(guhg& bug) at EO.Internal.guhi.uron(dqsq buk, guhg& bul) at EO.Internal.guhl.avcd() at EO.Internal.guhl..ctor(dqsq buo, HtmlToPdfOptions bup) at EO.Pdf.HtmlToPdfSession.lgnt(HtmlToPdfOptions abp, WebView abq) at EO.Pdf.HtmlToPdfSession..ctor(HtmlToPdfOptions abl, WebView abm, HtmlToPdfSession abn, ResourceHandler abo) at EO.Pdf.HtmlToPdfSession.Create(HtmlToPdfOptions options, ResourceHandler resourceHandler) at EO.Pdf.HtmlToPdf.glsb(HtmlToPdfOptions aes, getb`2 aet, Boolean aeu) at EO.Pdf.HtmlToPdf.glsa(HtmlToPdfOptions aeq, getb`2 aer) at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc, HtmlToPdfOptions options) at Price.Services.Submittals.Engine.Conversion.EssentialObjectsConverter.HtmlConversionItemConverter.CreatePdfDocument(IConversionItem conversionItem) at Price.Services.Submittals.Engine.Conversion.EssentialObjectsConverter.HtmlConversionItemConverter.CreatePdfDocumentOnDisk(IConversionItem conversionItem) at Price.Services.Submittals.Engine.Conversion.EssentialObjectsConverter.EssentialObjectsHtmlToPdfConversionEngine.CreatePdfCore(String pdfDestinationFilePath) at Price.Services.Submittals.Engine.Conversion.BaseHtmltoPdfConversionEngine.CreatePdf(String pdfDestinationFilePath) at Price.Services.Submittals.Engine.Generation.PdfGenerationEngine.Convert(PdfWideConversionSettings pdfWideSettings, List`1 conversionItems, String pdfDestinationFilePath) at Price.Services.Submittals.Engine.Generation.PdfGenerationEngine.GeneratePdfCore(PdfGenerationRequest pdfGenerationRequest, String pdfDestinationFilePath, IStaticPdfAttributeDefinitionRepository staticPdfAttributeDefinitionRepository) at Price.Services.Submittals.Engine.Generation.PdfGenerationEngine.GeneratePdf(PdfGenerationRequest pdfGenerationRequest, String pdfDestinationFilePath, IProductDefinitionRepository productDefinitionRepository, IStaticPdfAttributeDefinitionRepository staticPdfAttributeDefinitionRepository) at Price.Services.Submittals.Tray.Submittals.SubmittalService.Generate(PdfGenerationRequest request, String reportFilePath) at Price.Services.Submittals.Service.GenerateSubmittalUseCase.GenerateSubmittalUseCase.GenerateSubmittal(PdfGenerationRequest request, Guid submittalId) at Price.Services.Submittals.Service.GenerateSubmittalUseCase.GenerateSubmittalUseCase.Execute(SubmittalRequest submittalRequest, Int32 packageId, Boolean storeOnLocal) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Price.Services.Submittals.Service.GenerateSubmittalUseCase.GenerateSubmittalUseCase.Execute(SubmittalRequest submittalRequest, Int32 packageId, Boolean storeOnLocal) at Price.Services.Submittals.Service.Consumers.PackageCreatedConsumer.Consume(ConsumeContext`1 context) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result) at Price.Services.Submittals.Domain.Repository.PackageTaskRepository.GetAsync(Int32 id) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result) at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task.FinishStageTwo() at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread threadPoolThread) at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(Task task, Boolean taskWasPreviouslyQueued) at System.Threading.Tasks.TaskScheduler.TryRunInline(Task task, Boolean taskWasPreviouslyQueued) at System.Threading.Tasks.TaskContinuation.InlineIfPossibleOrElseQueue(Task task, Boolean needsProtection) at System.Threading.Tasks.ContinueWithTaskContinuation.Run(Task completedTask, Boolean canInlineContinuationTask) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task`1.TrySetResult(TResult result) at System.Threading.Tasks.UnwrapPromise`1.TrySetFromTask(Task task, Boolean lookForOce) at System.Threading.Tasks.UnwrapPromise`1.ProcessInnerTask(Task task) at System.Threading.Tasks.UnwrapPromise`1.ProcessCompletedOuterTask(Task task) at System.Threading.Tasks.UnwrapPromise`1.Invoke(Task completingTask) at System.Threading.Tasks.Task.RunContinuations(Object continuationObject) at System.Threading.Tasks.Task.FinishStageTwo() at System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) at System.Threading.Tasks.Task.ExecuteFromThreadPool(Thread threadPoolThread) at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback()
--- End of inner exception stack trace --- at Price.Services.Submittals.Engine.Conversion.EssentialObjectsConverter.HtmlConversionItemConverter.CreatePdfDocument(IConversionItem conversionItem) at Price.Services.Submittals.Engine.Conversion.EssentialObjectsConverter.HtmlConversionItemConverter.CreatePdfDocumentOnDisk(IConversionItem conversionItem) at Price.Services.Submittals.Engine.Conversion.EssentialObjectsConverter.EssentialObjectsHtmlToPdfConversionEngine.CreatePdfCore(String pdfDestinationFilePath) at Price.Services.Submittals.Engine.Conversion.BaseHtmltoPdfConversionEngine.CreatePdf(String pdfDestinationFilePath) at Price.Services.Submittals.Engine.Generation.PdfGenerationEngine.Convert(PdfWideConversionSettings pdfWideSettings, List`1 conversionItems, String pdfDestinationFilePath) at Price.Services.Submittals.Engine.Generation.PdfGenerationEngine.GeneratePdfCore(PdfGenerationRequest pdfGenerationRequest, String pdfDestinationFilePath, IStaticPdfAttributeDefinitionRepository staticPdfAttributeDefinitionRepository) at Price.Services.Submittals.Engine.Generation.PdfGenerationEngine.GeneratePdf(PdfGenerationRequest pdfGenerationRequest, String pdfDestinationFilePath, IProductDefinitionRepository productDefinitionRepository, IStaticPdfAttributeDefinitionRepository staticPdfAttributeDefinitionRepository) at Price.Services.Submittals.Tray.Submittals.SubmittalService.Generate(PdfGenerationRequest request, String reportFilePath) at Price.Services.Submittals.Service.GenerateSubmittalUseCase.GenerateSubmittalUseCase.GenerateSubmittal(PdfGenerationRequest request, Guid submittalId) at Price.Services.Submittals.Service.GenerateSubmittalUseCase.GenerateSubmittalUseCase.Execute(SubmittalRequest submittalRequest, Int32 packageId, Boolean storeOnLocal)
Thank you for your assistance. This issue is currently blocking reliable PDF generation in our service.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,491
|
Hi, This is usually due to memory fragmentation inside the hosting process. Internally the HTML to PDF relies on browser engine instances managed through EO.WebEngine.Engine class. This class requires a large chunk of continuous memory when it intializes the browser engine. This usually is not an issue when the process first starts but as the process continues to run for a long period of time, the memory space of the process becomes fragmented and it can become impossible to find a large chunk of continous memory space to complete the operation. Since the HTML to PDF converter perodically recycle the browser engine, it does need to re-initiaze the engine from time to time. However once it fails it is unable to recover since the underlying memory situation will never be satisified. The easiest workaround for such problem is to "commit suicide" by exiting the current hosting process when such error occurs. This would trigger a force restart of your App service. The current request would fail but the App Service should recover thus subsequent requests should succeed. The code would be something like this:
Code: C#
try
{
HtmlToPdf.ConvertHtml(....);
}
catch (OutOfMemoryException e)
{
//Exit the hosting process when an OutOfMemoryException
//occurs. This force Azure to restart the AppService hosting
//process. You can use a fixed exitCode for diagnostic/logging
//purpose
Environment.Exit(exitCode);
}
We will also be researching ways to reduce this large continuious memory allocation requirment on our end so that in the future you have less of a chance to run into this problem. Thanks!
|
Rank: Newbie Groups: Member
Joined: 4/10/2026 Posts: 2
|
Hi,
Thanks for taking the time to explain this so clearly and for the quick response.
We did try exiting the process on OutOfMemoryException as suggested, but unfortunately this approach doesn’t really work for us. In our case, PDF generation is part of a normal production flow, and we expect each request to complete successfully. Forcing the App Service to restart means the current request fails and can impact reliability for our users.
That said, we appreciate the transparency around the root cause and your efforts to improve this behavior going forward. Please keep us posted if there are other options or improvements we can try in the future.
Thanks again for your help.
|