biemster / gasr

Google Chrome SODA Offline Speech Recognition command line client
https://hackaday.io/project/164399-android-offline-speech-recognition-natively-on-pc
150 stars 18 forks source link

A weird error. #15

Closed goddade closed 1 year ago

goddade commented 1 year ago

Windows 10 wsl2 ubuntu 22.04 The version of libsoda.so is 1.1.1.2.

$ python3 gasr.py
[percpu.cc : 535] RAW: rseq syscall failed with errno 22 after membarrier sycall succeeded.
WARNING: Logging before InitGoogle() is written to STDERR
W0000 00:00:1674043446.296065     588 soda_async_impl.cc:334] Creating soda_impl.
W0000 00:00:1674043446.296105     588 soda_async_impl.cc:336] Created with thread priority 0
W0000 00:00:1674043448.473628     588 terse_processor.cc:342] TISID disabled.
W0000 00:00:1674043448.569745     605 portable_intended_query_stream.cc:236] Exiting due to stream cancellation.
W0000 00:00:1674043448.585990     588 decoder_endpointer_stream.cc:68] Acoustic ep reader thread cancelled.
W0000 00:00:1674043448.586232     588 soda_async_impl.cc:561] SODA session starting (require_hotword:0, hotword_timeout_in_millis:0, trigger_type:TRIGGER_TYPE_UNSPECIFIED, hybrid_asr_config.mode:MODE_DEFAULT)
Segmentation fault
$ gdb python3 /mnt/wslg/dumps/core.python3
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3...
Reading symbols from /usr/lib/debug/.build-id/93/99be8ddf8047a8ae050a6d3d18e4ce488264da.debug...
[New LWP 639]
[New LWP 643]
[New LWP 641]
[New LWP 644]
[New LWP 642]
[New LWP 640]
[New LWP 660]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `python3 gasr.py'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f9dff43e6f4 in speech::soda::ExtendedSodaAsyncWrapper::Start() () from ./libsoda.so
--Type <RET> for more, q to quit, c to continue without paging--

Then I tried to use python3-dbg to find more info, but it works fine.

biemster commented 1 year ago

If python3-dbg works fine, it's probably some race condition in the threading. Why do you use the linux lib through WSL on windows, instead of patching the DLL? (I don't have a windows machine, so you are a bit on your own on this issue tbh..)

goddade commented 1 year ago

Same problem in ubuntu 22.04 in virtualbox. 😔️ Any suggestions?

biemster commented 1 year ago

Just a stretch, but I'm seeing similar issues on old (15+ years) CPUs, probably missing some extensions that are compiled in the library. What machine are you running this on? Also, how did you patch libsoda?

goddade commented 1 year ago

Virturalbox runs on ubuntu 20.04, cpu is Intel(R) Xeon(R) Gold 5117. WSL2 runs on windows 10, cpu is Intel(R) Core(TM) i7-6700.

biemster commented 1 year ago

That is unlikely to be the issue then, really odd. It's possible that your way of patching the library broke something, it's impossible for me to guess what is going wrong with the information provided..

goddade commented 1 year ago

Works fine in c++. #16 I forgot to mention the way I patched the library. I changed 31 C0 to B0 01.

biemster commented 1 year ago

Thanks for the PR, looks nice. Your patch is nicely small, I think to remember I did it slightly different so it might be from that. Seeing you got it running in C++ I can close this as won't fix? (Since I don't have a clue why it does this)

goddade commented 1 year ago

OK I try to make a c++ warpper, then call it in python.

biemster commented 1 year ago

@goddade does 0914d70 address this?

goddade commented 1 year ago

@goddade does 0914d70 address this?

Yes.

goddade commented 1 year ago

Pointers in python3-dbg are 32-bit, so ...

biemster commented 1 year ago

This must have been quite a puzzler to figure out! Well done and thanks a lot.