k2-fsa/icefall

Fixes for segfault

csukuangfj opened this issue · 3 comments

In the last few days, a few people (>3) have encountered the following error after updating their lhotse to the latest version:

Segmentation fault (core dump)

when they try to run one of the python scripts from icefall.

After using

gdb --args python xxx.py

(gdb) run
(gdb) backtrace

They get

Thread 1 "python" received signal SIGSEGV, Segmentation fault.
0x00007fff75d00dd1 in google::protobuf::internal::ReflectionOps::FindInitializationErrors(google::protobuf::Message const&, std::string const&, std::vector<std::string, std::allocator<std::string> >*) ()
   from /xxxxxx/lib/python3.8/site-packages/google/protobuf/pyext/_message.cpython-38-x86_64-linux-gnu.so

(gdb) backtrace
#0  0x00007fff75d00dd1 in google::protobuf::internal::ReflectionOps::FindInitializationErrors(google::protobuf::Message const&, std::string const&, std::vector<std::string, std::allocator<std::string> >*) ()
   from /xxxxxx/lib/python3.8/site-packages/google/protobuf/pyext/_message.cpython-38-x86_64-linux-gnu.so
#1  0x00007fff75cf8d05 in google::protobuf::Message::FindInitializationErrors(std::vector<std::string, std::allocator<std::string> >*) const ()
   from /xxxxxx/lib/python3.8/site-packages/google/protobuf/pyext/_message.cpython-38-x86_64-linux-gnu.so

The tensorboard python package introduces the dependency on protobuf and the error is caused by
timpalpant/pypprof#2 (comment)


The fix is to set the following environment variable before running any python scripts:

export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

I suggest that we add

export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

to prepare.sh of each recipe.

I suggest that we add

export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python

to prepare.sh of each recipe.

cool! thanks!

It works for Aborted (core dumped) too.