cognitive-services-speech-sdk: always got RuntimeError: Exception with an error code: 0x8 (SPXERR_FILE_OPEN_FAILED)

Describe the bug I wrote Python script to submit a test set with 15000 audio clips(.wav files). I used multithreads to submit 10 files each time, but got the following error every time after ~1000 files is completed:

RuntimeError: Exception with an error code: 0x8 (SPXERR_FILE_OPEN_FAILED)
[CALL STACK BEGIN]

3   libMicrosoft.CognitiveServices.Speech.core.dylib 0x0000000106406aaf CreateModuleObject + 1132863
4   libMicrosoft.CognitiveServices.Speech.core.dylib 0x0000000106404295 CreateModuleObject + 1122597
5   libMicrosoft.CognitiveServices.Speech.core.dylib 0x0000000106404925 CreateModuleObject + 1124277
6   libMicrosoft.CognitiveServices.Speech.core.dylib 0x00000001063004e1 CreateModuleObject + 58225
7   libMicrosoft.CognitiveServices.Speech.core.dylib 0x0000000106340c64 CreateModuleObject + 322292
8   libMicrosoft.CognitiveServices.Speech.core.dylib 0x000000010633fbe5 CreateModuleObject + 318069
9   libMicrosoft.CognitiveServices.Speech.core.dylib 0x000000010633d5a2 CreateModuleObject + 308274
10  libMicrosoft.CognitiveServices.Speech.core.dylib 0x000000010633d7c3 CreateModuleObject + 308819
11  libMicrosoft.CognitiveServices.Speech.core.dylib 0x000000010628fbc7 recognizer_create_speech_recognizer_from_config + 3863
12  libMicrosoft.CognitiveServices.Speech.core.dylib 0x000000010628ed74 recognizer_create_speech_recognizer_from_config + 196
13  _speech_py_impl.so                  0x000000010612e35b PyInit__speech_py_impl + 814939
14  _speech_py_impl.so                  0x00000001060ca530 PyInit__speech_py_impl + 405808
15  python                              0x00000001058bd92e _PyMethodDef_RawFastCallKeywords + 350
16  python                              0x00000001059fdb47 call_function + 247
17  python                              0x00000001059fb684 _PyEval_EvalFrameDefault + 45284
18  python                              0x00000001058bd078 function_code_fastcall + 120
19  python                              0x00000001059fdafe call_function + 174
20  python                              0x00000001059fb684 _PyEval_EvalFrameDefault + 45284
21  python                              0x00000001059ef2d2 _PyEval_EvalCodeWithName + 418
22  python                              0x00000001058bc577 _PyFunction_FastCallDict + 231
23  python                              0x00000001059400b1 slot_tp_init + 193
24  python                              0x000000010594a091 type_call + 241
25  python                              0x00000001058bd283 _PyObject_FastCallKeywords + 179
26  python                              0x00000001059fdbe4 call_function + 404
27  python                              0x00000001059fb778 _PyEval_EvalFrameDefault + 45528
28  python                              0x00000001058bd078 function_code_fastcall + 120
29  python                              0x00000001059e724e map_next + 126
30  python                              0x00000001058e6604 list_extend + 1156
31  python                              0x00000001058e606a list___init__ + 138
32  python                              0x000000010594a091 type_call + 241
33  python                              0x00000001058bd283 _PyObject_FastCallKeywords + 179
34  python                              0x00000001059fdbe4 call_function + 404
35  python                              0x00000001059fb6bf _PyEval_EvalFrameDefault + 45343
36  python                              0x00000001058bd078 function_code_fastcall + 120
37  python                              0x00000001059fb8cf _PyEval_EvalFrameDefault + 45871
38  python                              0x00000001059ef2d2 _PyEval_EvalCodeWithName + 418
39  python                              0x00000001058bc577 _PyFunction_FastCallDict + 231
40  python                              0x00000001059fb8cf _PyEval_EvalFrameDefault + 45871
41  python                              0x00000001058bd078 function_code_fastcall + 120
42  python                              0x00000001059fdafe call_function + 174
43  python                              0x00000001059fb5ee _PyEval_EvalFrameDefault + 45134
44  python                              0x00000001058bd078 function_code_fastcall + 120
45  python                              0x00000001059fdafe call_function + 174
46  python                              0x00000001059fb5ee _PyEval_EvalFrameDefault + 45134
47  python                              0x00000001058bd078 function_code_fastcall + 120
48  python                              0x00000001058c04a2 method_call + 130
49  python                              0x00000001058bdef2 PyObject_Call + 130
50  python                              0x0000000105adf11b t_bootstrap + 123
51  libsystem_pthread.dylib             0x00007fff64dc8305 _pthread_body + 126
52  libsystem_pthread.dylib             0x00007fff64dcb26f _pthread_start + 70
53  libsystem_pthread.dylib             0x00007fff64dc7415 thread_start + 13
[CALL STACK END]

Looks like a failure due to file open, but have double checked with all the files, all of them are in correct format.

To Reproduce Steps to reproduce the behavior:

  1. Create a thread pool of 10 threads using multiprocessing.dummy
  2. Each thread take one audio file
  3. For each file, create a SpeechRecognizer, then call speech_recognize_continuous_from_file(function in samples)

Expected behavior I expected the script running until all 15000 tests finished.

Version of the Cognitive Services Speech SDK I believe it’s the most updated version.

Platform, Operating System, and Programming Language Screen Shot 2019-11-19 at 2 14 33 PM

  • OS: MacOS Mojave
  • Programming language: Python

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 29 (6 by maintainers)

Most upvoted comments

Ok it works if the file is in the same directory. Still it’s a weird behavior that the library doesn’t works with files from other locations than the script’s directory.

I have a file in the same directory as the script.

This is not related to multithread execution. I got the same error running single threaded, after ~1000 (long >15s) utterances. When I retry file which just crashed, it always works OK.

It crashes on line: speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_config)

File “/home/ec2-user/anaconda3/lib/python3.7/site-packages/azure/cognitiveservices/speech/speech.py”, line 761, in init File “/home/ec2-user/anaconda3/lib/python3.7/site-packages/azure/cognitiveservices/speech/speech.py”, line 547, in _get_impl RuntimeError: Exception with an error code: 0x8 (SPXERR_FILE_OPEN_FAILED)