Skip to content
English
  • There are no suggestions because the search field is empty.

[Public] Troubleshooting Segmentation Fault and wstring_convert::from_bytes Error in IronPDF on AWS Lambda (Linux)

This article outlines an intermittent issue with IronPDF in a Dockerized .NET app on AWS Lambda (Linux), where PDF generation may trigger a segmentation fault or a wstring_convert::from_bytes error.

Issue Description

The application is expected to generate a PDF from HTML. However, one of the following issues may intermittently occur:

  • ❌ Segmentation fault (SIGSEGV)

  • ❌ C++ Exception: wstring_convert::from_bytes

These errors are not deterministic and may happen only after the first or second invocation of the Lambda container. Below are the sample log output for this issue

Process runtime-1 exited: signal: segmentation fault
Error while generating PDF from HTML: 'wstring_convert::from_bytes

 

Other logs show that the Lambda container exits with signal errors shortly after execution begins.

 

Root Cause

The issue seems related to multi-process rendering and global renderer reuse within the Lambda Docker container. Memory leaks or improper disposal of IronPDF rendering objects may also contribute to the crash.

 

Recommended Fixes

The following guidelines help resolve or reduce the frequency of segmentation faults:

 

✅ DO:

 

Screenshot 2025-06-06 112313

  • Use Installation.SingleProcess = true

  • Avoid calling Installation.Initialize()

  • Set paths to /tmp:

     

    Screenshot 2025-06-06 112532 
     

❌ DON'T:

 
// Avoid global renderer reuse
private readonly ChromePdfRenderer _renderer = new();

public async Task<Stream> FunctionHandler(Stream request, ILambdaContext context){
Installation.Initialize(); // ❌ Not recommended
ChromePdfRenderer _renderer = new();
}

Conclusion

When using IronPDF on Linux in a containerized AWS Lambda environment, it's critical to:

  • Run in single-process mode,

  • Create a new ChromePdfRenderer instance per function invocation,

  • Dispose of all resources explicitly,

  • Avoid persistent global renderer usage,

  • Set all paths to the temporary /tmp directory.

These adjustments help avoid segmentation faults and improve the stability of IronPDF in serverless deployments.