Kitt-AI / snowboy

Future versions with model training module will be maintained through a forked version here: https://github.com/seasalt-ai/snowboy
Other
3.11k stars 1.01k forks source link

Kitt.AI crash on Ubuntu 16.04 and Alexa SDK #459

Open visayamv opened 6 years ago

visayamv commented 6 years ago

We currently hit an exception issue when we try to integrate Kitt.AI with Alexa SDK. The issue happens every time we initialize Kitt.AI.

Exception happens when it calls the snowboy::ParseOptions::ParseOptions(std::string const&) function...

Since we don't have the source we weren't able to trace what's going on here. Can you help us find out what's wrong with it? Here's the full stacktrace of the crash:

0x00007ffff3b3a428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 54 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt

0 0x00007ffff3b3a428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54

1 0x00007ffff3b3c02a in __GI_abort () at abort.c:89

2 0x00007ffff3b7c7ea in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff3c95ed8 " Error in `%s': %s: 0x%s \n") at ../sysdeps/posix/libc_fatal.c:175

3 0x00007ffff3b89698 in malloc_printerr (ar_ptr=0x0, ptr=, str=0x7ffff3c95f00 "munmap_chunk(): invalid pointer", action=) at malloc.c:5006

4 munmap_chunk (p=) at malloc.c:2842

5 __GI___libc_free (mem=) at malloc.c:2963

6 0x00000000005d8026 in gnu_cxx::new_allocator<std::detail::_Hash_node_base*>::deallocate (this=0x7fffffff9f6f, __p=0x7fffffffa370) at /usr/include/c++/4.8/ext/new_allocator.h:110

7 0x00007ffff59e2124 in std::_Hashtable<std::string, std::string, std::allocator, std::detail::_Identity, std::equal_to, std::hash, std::detail::_Mod_range_hashing, std::detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::detail::_Hashtable_traits<true, true, true> >::_M_deallocate_buckets (

this=0x7fffffffa340, __p=0x7fffffffa370, __n=1) at /usr/include/c++/4.8/bits/hashtable.h:794

8 0x00007ffff59eea56 in std::_Hashtable<std::string, std::string, std::allocator, std::detail::_Identity, std::equal_to, std::hash, std::detail::_Mod_range_hashing, std::detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::detail::_Hashtable_traits<true, true, true> >::_M_rehash_aux (

this=0x7fffffffa340, __n=2) at /usr/include/c++/4.8/bits/hashtable.h:1725

9 0x00007ffff59ed91d in std::_Hashtable<std::string, std::string, std::allocator, std::detail::_Identity, std::equal_to, std::hash, std::detail::_Mod_range_hashing, std::detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::detail::_Hashtable_traits<true, true, true> >::_M_rehash (this=0x7fffffffa340,

__n=2, __state=@0x7fffffffa070: 0) at /usr/include/c++/4.8/bits/hashtable.h:1680

10 0x00007ffff59ebc13 in std::_Hashtable<std::string, std::string, std::allocator, std::detail::_Identity, std::equal_to, std::hash, std::detail::_Mod_range_hashing, std::detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::detail::_Hashtable_traits<true, true, true> >::_M_insert_unique_node (

this=0x7fffffffa340, __bkt=0, __code=5527048210019181220, __node=0xbdaaf0) at /usr/include/c++/4.8/bits/hashtable.h:1335

11 0x00007ffff0bc031c in std::pair<std::detail::_Node_iterator<std::string, true, true>, bool> std::_Hashtable<std::string, std::string, std::allocator, std::detail::_Identity, std::equal_to, std::hash, std::detail::_Mod_range_hashing, std::detail::_Default_ranged_hash, std::detail::_Prime_rehash_policy, std::detail::_Hashtable_traits<true, true, true> >::_M_insert<std::string, std::detail::_AllocNode<std::allocator<std::detail::_Hash_node<std::string, true> > > >(std::string&&, std::__detail::_AllocNode<std::allocator<std::__detail::_Hash_node<std::string, true> > > const&, std::integral_constant<bool, true>) () from /workplace/alexaClientSDK/BUILD2/KWD/KittAi/src/libKITTAI.so

12 0x00007ffff0bbe681 in snowboy::ParseOptions::ParseOptions(std::string const&) () from /workplace/alexaClientSDK/BUILD2/KWD/KittAi/src/libKITTAI.so

13 0x00007ffff0badbf7 in snowboy::PipelineItf::SetResource(std::string const&) () from /workplace/alexaClientSDK/BUILD2/KWD/KittAi/src/libKITTAI.so

14 0x00007ffff0b9679a in snowboy::SnowboyDetect::SnowboyDetect(std::string const&, std::string const&) () from /workplace/alexaClientSDK/BUILD2/KWD/KittAi/src/libKITTAI.so

15 0x00007ffff0b8f274 in alexaClientSDK::avsCommon::utils::memory::make_unique<snowboy::SnowboyDetect, std::string const&, std::string>(std::string const&, std::string&&) () at /workplace/alexaClientSDK/AlexaClientSDK/AVSCommon/Utils/include/AVSCommon/Utils/Memory/Memory.h:35

Python Exception <class 'gdb.error'> cannot resolve overloaded method _M_before_begin': no arguments supplied: Python Exception <class 'gdb.error'> cannot resolve overloaded method_M_before_begin': no arguments supplied:

16 0x00007ffff0b8c6b1 in alexaClientSDK::kwd::KittAiKeyWordDetector::KittAiKeyWordDetector (this=0xbda3d0, stream=std::shared_ptr (count 12179072, weak -1) 0x7fffffffa940, audioFormat=..., keyWordObservers=std::unordered_set with 12179040 elements, keyWordDetectorStateObservers=std::unordered_set with 12428240 elements,

resourceFilePath="/workplace/alexaClientSDK/inputs/common.res", kittAiConfigurations=std::vector of length 34, capacity 4 = {...}, audioGain=2, applyFrontEnd=true, msToPushPerIteration=...) at /workplace/alexaClientSDK/AlexaClientSDK/KWD/KittAi/src/KittAiKeyWordDetector.cpp:134

Python Exception <class 'gdb.error'> cannot resolve overloaded method _M_before_begin': no arguments supplied: Python Exception <class 'gdb.error'> cannot resolve overloaded method_M_before_begin': no arguments supplied:

17 0x00007ffff0b8bfb6 in alexaClientSDK::kwd::KittAiKeyWordDetector::create (stream=std::shared_ptr (count 10, weak 0) 0xb983d0, audioFormat=..., keyWordObservers=std::unordered_set with 1 elements, keyWordDetectorStateObservers=std::unordered_set with 0 elements, resourceFilePath="/workplace/alexaClientSDK/inputs/common.res",

kittAiConfigurations=std::vector of length 1, capacity 1 = {...}, audioGain=2, applyFrontEnd=true, msToPushPerIteration=...) at /workplace/alexaClientSDK/AlexaClientSDK/KWD/KittAi/src/KittAiKeyWordDetector.cpp:95

Python Exception <class 'gdb.error'> cannot resolve overloaded method _M_before_begin': no arguments supplied: Python Exception <class 'gdb.error'> cannot resolve overloaded method_M_before_begin': no arguments supplied:

18 0x00007ffff71a2edc in alexaClientSDK::kwd::KeywordDetectorProvider::create (stream=std::shared_ptr (count 10, weak 0) 0xb983d0, audioFormat=..., keyWordObservers=std::unordered_set with 1 elements, keyWordDetectorStateObservers=std::unordered_set with 0 elements, pathToInputFolder="/workplace/alexaClientSDK/inputs")

at /workplace/alexaClientSDK/AlexaClientSDK/KWD/KWDProvider/src/KeywordDetectorProvider.cpp:56

19 0x00000000005ddc4c in alexaClientSDK::sampleApp::SampleApplication::initialize (this=0x907ca0, configFiles=std::vector of length 1, capacity 1 = {...}, pathToInputFolder="/workplace/alexaClientSDK/inputs", logLevel="") at /workplace/alexaClientSDK/AlexaClientSDK/SampleApp/src/SampleApplication.cpp:639

20 0x00000000005daafc in alexaClientSDK::sampleApp::SampleApplication::create (configFiles=std::vector of length 1, capacity 1 = {...}, pathToInputFolder="/workplace/alexaClientSDK/inputs", logLevel="") at /workplace/alexaClientSDK/AlexaClientSDK/SampleApp/src/SampleApplication.cpp:157

21 0x00000000006008a6 in main (argc=3, argv=0x7fffffffdc48) at /workplace/alexaClientSDK/AlexaClientSDK/SampleApp/src/main.cpp:108

visayamv commented 6 years ago

To reproduce this issue, in snowboy/examples/C++/demo.cc

  1. Add an include:

    include

  2. then declare a global variable: std::unordered_set SETTINGS_ACCEPTED_KEYS = {"locale"};
  3. make
  4. run

visayamv@u4a12ca31be8a55:~/snowboy/examples/C++$ ./demo Error in `./demo': munmap_chunk(): invalid pointer: 0x00007fffdd78cea0 ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f77db26b7e5] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x1a8)[0x7f77db278698] ./demo(_ZNSt10_HashtableISsSsSaISsENSt8detail9_IdentityESt8equal_toISsESt4hashISsENS1_18_Mod_range_hashingENS1_20_Default_ranged_hashENS1_20_Prime_rehash_policyENS1_17_Hashtable_traitsILb1ELb1ELb1EEEE21_M_insert_unique_nodeEmmPNS1_10_Hash_nodeISsLb1EEE+0xe9)[0x41df09] ./demo(_ZNSt10_HashtableISsSsSaISsENSt8detail9_IdentityESt8equal_toISsESt4hashISsENS1_18_Mod_range_hashingENS1_20_Default_ranged_hashENS1_20_Prime_rehash_policyENS1_17_Hashtable_traitsILb1ELb1ELb1EEEE9_M_insertISsNS1_10_AllocNodeISaINS1_10_Hash_nodeISsLb1EEEEEEEESt4pairINS1_14_Node_iteratorISsLb1ELb1EEEbEOT_RKT0_St17integral_constantIbLb1EE+0x9c)[0x45707c] ./demo(_ZN7snowboy12ParseOptionsC2ERKSs+0x221)[0x455511] ./demo(_ZN7snowboy11PipelineItf11SetResourceERKSs+0x177)[0x444a87] ./demo(ZN7snowboy13SnowboyDetectC1ERKSsS2+0x6a)[0x42d62a] ./demo(main+0xe5)[0x41d0c5] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f77db214830] ./demo(_start+0x29)[0x41d769]

visayamv commented 6 years ago

Attached is the diff diff.txt

visayamv commented 6 years ago

visayamv@u4a12ca31be8a55:~/snowboy/examples/C++$ uname -a Linux u4a12ca31be8a55.ant.amazon.com 4.13.0-39-generic #44~16.04.1-Ubuntu SMP Thu Apr 5 16:43:10 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

visayamv@u4a12ca31be8a55:~/snowboy/examples/C++$ g++ --version g++ (Ubuntu 4.8.5-4ubuntu2) 4.8.5 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

junlon2006 commented 6 years ago

does It fix now? I hit the same exception issue