alphacep/vosk-api

Segmentation fault on recognizer.close() in Java

olafth opened this issue · 3 comments

I have a RSocket channel, send data and recognition works.
On resource cleanup, specifically on recognizer.close a SIGSEGV happens. I am using VoskApi 0.3.45 and also compiled the current master (0.3.48) and installed libvosk.so in /usr/lib. No changes. OS is Kubuntu 22.04. The SIGSEGV happens both with a self written RSocket client and rsc.jar and the commandline
java -jar rsc.jar --debug --channel --load ./de_1.wav --route audio.bytes.de tcp://localhost:7000

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007b51a67e791f, pid=60565, tid=62882
#
# JRE version: OpenJDK Runtime Environment (17.0.10+13) (build 17.0.10+13-LTS)
# Java VM: OpenJDK 64-Bit Server VM (17.0.10+13-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C  [jna18035368486101055434.tmp+0x3e791f]  kaldi::LatticeIncrementalDecoderTpl<fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > >, kaldi::decoder::BackpointerToken>::~LatticeIncrementalDecoderTpl()+0x1f
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/otho/IdeaProjects/VoskServer/Thor11Asr/core.60565)
#
# An error report file with more information is saved as:
# /home/[...]/hs_err_pid60565.log
_malloc_consolidate(): invalid chunk size_```

I found the problem. It happens when the recognizer is not disposed of correctly. This should definitely raise an exception, but a SIGSEGV is a bit much :)