#223·moonshine

Android: process crashes (SIGABRT "destroyed mutex") when close() is called while transcribing

Author: monneyboiCreated Aug 30, 2026Updated Aug 31, 2026

Hi, I'm trying to build a little voice keyboard for personal use and I'm running into the problem of my keyboard crashing when I open it quickly after closing it.

Package: ai.moonshine:moonshine-voice:0.1.5 (arm64) Device: Pixel 8, Android 17

Steps to reproduce

Following the usage in the docs and the examples/android/Transcriber sample:

  1. new MicTranscriber(context).onText(...).onLine(...); load(); start() on a background thread.
  2. Speak.
  3. Call stop() immediately followed by close() right after speaking (observed when an always-listening IME service was closed just after dictation).

Expected

No crash.

Actual

The process dies.

Fatal signal 6 (SIGABRT) in tid (moonshine-mic-t)
Abort message: 'FORTIFY: pthread_mutex_lock called on a destroyed mutex'

#09 Transcriber::decode_full(...)
#12 Transcriber::transcribe_stream(...)
#13 moonshine_transcribe_stream
#14 Java_ai_moonshine_voice_JNI_moonshineTranscribeStream
#20 Transcriber.addAudioToStream
#24 MicTranscriber.audioProcessingLoop

Thanks for the nice project! Let me know if I'm misunderstanding something.