Skip to content

Fix SherpaOnnx finalizer crash with DllNotFoundException#745

Merged
steipete merged 4 commits into
openclaw:mainfrom
williamwwm:main
Jun 15, 2026
Merged

Fix SherpaOnnx finalizer crash with DllNotFoundException#745
steipete merged 4 commits into
openclaw:mainfrom
williamwwm:main

Conversation

@williamwwm

Copy link
Copy Markdown
Contributor

Suppress fatal crashes caused by SherpaOnnx.OfflineTts finalizer calling SherpaOnnxDestroyOfflineTts when native DLL is unavailable.

Changes:

  • PiperTextToSpeechClient: gracefully handle DllNotFoundException in constructor (TTS disabled gracefully), add GC.SuppressFinalize after dispose to prevent finalizer from calling native code during GC
  • App.xaml.cs: improved OnDomainUnhandledException logging for SherpaOnnx native DLL errors
  • Crash prevention relies on exe.config legacyUnhandledExceptionPolicy and GC.SuppressFinalize (IsTerminating is readonly in .NET 10)

Fixes repeated crashes: System.DllNotFoundException: Unable to load DLL 'sherpa-onnx-c-api' at SherpaOnnx.OfflineTts.Finalize()

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

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants