program crash when test hotwords in andriod and ios
HalFTeen opened this issue · 3 comments
HalFTeen commented
**error log for andriod:**
`2023-08-31 17:10:05.242 23487-24241 libc com.k2fsa.sherpa.ncnn A Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20 in tid 24241 (Thread-7), pid 23487 (fsa.sherpa.ncnn)
2023-08-31 17:10:05.472 24258-24258 DEBUG pid-24258 A pid: 23487, tid: 24241, name: Thread-7 >>> com.k2fsa.sherpa.ncnn <<<
2023-08-31 17:10:05.724 24258-24258 DEBUG pid-24258 A #00 pc 0000000000021054 /data/app/com.k2fsa.sherpa.ncnn-TBEcWxQLxvHnK1PaOKfmPQ==/lib/arm64/libsherpa-ncnn-core.so (sherpa_ncnn::ContextGraph::ForwardOneStep(sherpa_ncnn::ContextState const*, int) const+12) (BuildId: b21b666f6a77aa6a0ee5427e1e3e3d737da77c12)
2023-08-31 17:10:05.724 24258-24258 DEBUG pid-24258 A #01 pc 000000000003a470 /data/app/com.k2fsa.sherpa.ncnn-TBEcWxQLxvHnK1PaOKfmPQ==/lib/arm64/libsherpa-ncnn-core.so (sherpa_ncnn::ModifiedBeamSearchDecoder::Decode(ncnn::Mat, sherpa_ncnn::Stream*, sherpa_ncnn::DecoderResult*)+2824) (BuildId: b21b666f6a77aa6a0ee5427e1e3e3d737da77c12)
2023-08-31 17:10:05.724 24258-24258 DEBUG pid-24258 A #02 pc 000000000003c820 /data/app/com.k2fsa.sherpa.ncnn-TBEcWxQLxvHnK1PaOKfmPQ==/lib/arm64/libsherpa-ncnn-core.so (sherpa_ncnn::Recognizer::Impl::DecodeStream(sherpa_ncnn::Stream*) const+580) (BuildId: b21b666f6a77aa6a0ee5427e1e3e3d737da77c12)
2023-08-31 17:10:05.725 24258-24258 DEBUG pid-24258 A #10 pc 00000000000038fc [anon:dalvik-classes3.dex extracted in memory from /data/app/com.k2fsa.sherpa.ncnn-TBEcWxQLxvHnK1PaOKfmPQ==/base.apk!classes3.dex] (com.k2fsa.sherpa.ncnn.SherpaNcnn.decode+4)
2023-08-31 17:10:05.725 24258-24258 DEBUG pid-24258 A #14 pc 00000000020118a0 /memfd:/jit-cache (deleted) (com.k2fsa.sherpa.ncnn.MainActivity.readPcmFromAssets+640)
2023-08-31 17:10:05.725 24258-24258 DEBUG pid-24258 A #19 pc 00000000000027c6 [anon:dalvik-classes3.dex extracted in memory from /data/app/com.k2fsa.sherpa.ncnn-TBEcWxQLxvHnK1PaOKfmPQ==/base.apk!classes3.dex] (com.k2fsa.sherpa.ncnn.MainActivity.readPcmFromAssets+86)
2023-08-31 17:10:05.725 24258-24258 DEBUG pid-24258 A #22 pc 0000000000001f4c [anon:dalvik-classes3.dex extracted in memory from /data/app/com.k2fsa.sherpa.ncnn-TBEcWxQLxvHnK1PaOKfmPQ==/base.apk!classes3.dex] (com.k2fsa.sherpa.ncnn.MainActivity.access$readPcmFromAssets)
2023-08-31 17:10:05.725 24258-24258 DEBUG pid-24258 A #25 pc 0000000000001d9c [anon:dalvik-classes3.dex extracted in memory from /data/app/com.k2fsa.sherpa.ncnn-TBEcWxQLxvHnK1PaOKfmPQ==/base.apk!classes3.dex] (com.k2fsa.sherpa.ncnn.MainActivity$onclick$1.invoke+8)
2023-08-31 17:10:05.725 24258-24258 DEBUG pid-24258 A #28 pc 0000000000001d58 [anon:dalvik-classes3.dex extracted in memory from /data/app/com.k2fsa.sherpa.ncnn-TBEcWxQLxvHnK1PaOKfmPQ==/base.apk!classes3.dex] (com.k2fsa.sherpa.ncnn.MainActivity$onclick$1.invoke)
2023-08-31 17:10:05.725 24258-24258 DEBUG pid-24258 A #31 pc 00000000003a3658 [anon:dalvik-classes.dex extracted in memory from /data/app/com.k2fsa.sherpa.ncnn-TBEcWxQLxvHnK1PaOKfmPQ==/base.apk] (kotlin.concurrent.ThreadsKt$thread$thread$1.run+4)
---------------------------- PROCESS ENDED (23487) for package com.k2fsa.sherpa.ncnn ----------------------------`
btw, the function AAssetManager_open
https://github.com/k2-fsa/sherpa-ncnn/blob/401de811948a3435604b0bc0505b577d595eda96/sherpa-ncnn/csrc/recognizer.cc#L246C4-L246C75, can only read hotwords file in apk, not in storage. apk has to update if hotwords file is changed. it is too heavy.
csukuangfj commented
Please pass null
for the following function to assetManager
.
csukuangfj commented
please see
HalFTeen commented
Thanks, v2.1.1 fixes this crash issue, it works well for andriod and ios. And AAssetManager_open, just ignore it, my bad misunderstanding.