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.08k stars 997 forks source link

Error in `node': munmap_chunk(): invalid pointer #441

Open goszczynskip opened 6 years ago

goszczynskip commented 6 years ago

Environment: VirtualBox 5.6.2 Host: Windows10, Guest: Linux Ubuntu 16.04.4 LTS node: 9.11.1 npm: 5.6.0 snowboy: 1.3.1

I've installed snowboy from npm, copied node example to index.js and provided resource files.

File structure:

├── index.js
├── package.json
├── package-lock.json
├── resources
    ├── common.res
    └── snowboy.umdl

my index.js looks like this:

const record = require('node-record-lpcm16');                                
const Detector = require('snowboy').Detector;                                
const Models = require('snowboy').Models;                                    
const models = new Models();                                                 

models.add({                                                                 
  file: 'resources/snowboy.umdl',                                            
  sensitivity: '0.5',                                                        
  hotwords : 'snowboy'                                                       
});                                                                          

const detector = new Detector({                                              
  resource: "resources/common.res",                                          
  models: models,                                                            
  audioGain: 2.0,                                                            
  applyFrontend: true                                                        
});                                                                          

detector.on('silence', function () {                                         
  console.log('silence');                                                    
});                                                                          

detector.on('sound', function (buffer) {                                     
  // <buffer> contains the last chunk of the audio that triggers the "sound" 
  // event. It could be written to a wav stream.                             
  console.log('sound');                                                      
});                                                                          

detector.on('error', function () {                                           
  console.log('error');                                                      
});                                                                          

detector.on('hotword', function (index, hotword, buffer) {                           
  // <buffer> contains the last chunk of the audio that triggers the "hotword"       
  // event. It could be written to a wav stream. You will have to use it             
  // together with the <buffer> in the "sound" event if you want to get audio        
  // data after the hotword.                                                         
  console.log(buffer);                                                               
  console.log('hotword', index, hotword);                                            
});                                                                                  

const mic = record.start({                                                           
  threshold: 0,                                                                      
  verbose: true                                                                      
});                                                                                  

mic.pipe(detector);                                                                             

After running node index.js I'm getting error: Error in `node': munmap_chunk(): invalid pointer: 0x00007ffea82bed00

Full stacktrace:

======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fe4ad7427e5]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x1a8)[0x7fe4ad74f698]
node(_ZNSt10_HashtableISsSsSaISsENSt8__detail9_IdentityESt8equal_toISsESt4hashISsENS1_18_Mod_range_hashingENS1_20_Default_ranged_hashENS1_20_Prime_rehash_policyENS1_17_Hashtable_traitsILb1ELb1ELb1EEEE21_M_insert_unique_nodeEmmPNS1_10_Hash_nodeISsLb1EEE+0x12c)[0x9339ac]
/home/piotr/voicerecognition/node_modules/snowboy/lib/node/binding/Release/node-v59-linux-x64/snowboy.node(_ZNSt10_HashtableISsSsSaISsENSt8__detail9_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)[0x7fe4ab45e12c]
/home/piotr/voicerecognition/node_modules/snowboy/lib/node/binding/Release/node-v59-linux-x64/snowboy.node(_ZN7snowboy12ParseOptionsC2ERKSs+0x221)[0x7fe4ab45c491]
/home/piotr/voicerecognition/node_modules/snowboy/lib/node/binding/Release/node-v59-linux-x64/snowboy.node(_ZN7snowboy11PipelineItf11SetResourceERKSs+0x177)[0x7fe4ab44ba07]
/home/piotr/voicerecognition/node_modules/snowboy/lib/node/binding/Release/node-v59-linux-x64/snowboy.node(_ZN7snowboy13SnowboyDetectC1ERKSsS2_+0x6a)[0x7fe4ab4345aa]
/home/piotr/voicerecognition/node_modules/snowboy/lib/node/binding/Release/node-v59-linux-x64/snowboy.node(_ZN13SnowboyDetectC1ERKSsS1_+0x5f)[0x7fe4ab43382f]

/home/piotr/voicerecognition/node_modules/snowboy/lib/node/binding/Release/node-v59-linux-x64/snowboy.node(_ZN13SnowboyDetect3NewERKN3Nan20FunctionCallbackInfoIN2v85ValueEEE+0x4c5)[0x7fe4ab433dc5]
/home/piotr/voicerecognition/node_modules/snowboy/lib/node/binding/Release/node-v59-linux-x64/snowboy.node(+0x20e45)[0x7fe4ab430e45]
node(_ZN2v88internal25FunctionCallbackArguments4CallEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEE+0x193)[0xaa0d03]
node[0xb1824f]
node(_ZN2v88internal21Builtin_HandleApiCallEiPPNS0_6ObjectEPNS0_7IsolateE+0xf5)[0xb189c5]
[0x2eb7707842fd]
======= Memory map: ========
00400000-01f9b000 r-xp 00000000 fc:00 281398                             /usr/bin/node
0219b000-021b5000 rw-p 01b9b000 fc:00 281398                             /usr/bin/node
021b5000-021cd000 rw-p 00000000 00:00 0
03db2000-03f46000 rw-p 00000000 00:00 0                                  [heap]
222efa80000-222efb00000 rw-p 00000000 00:00 0
3b9f1880000-3b9f18cf000 rw-p 00000000 00:00 0
4d5d3880000-4d5d3900000 rw-p 00000000 00:00 0
80cf9000000-80cf9080000 rw-p 00000000 00:00 0
91bb5a80000-91bb5b00000 rw-p 00000000 00:00 0
1f7f6a880000-1f7f6a900000 rw-p 00000000 00:00 0
22d056800000-22d056880000 rw-p 00000000 00:00 0
23abc3500000-23abc3580000 rw-p 00000000 00:00 0
2a4448e80000-2a4448f00000 rw-p 00000000 00:00 0
2b25fd500000-2b25fd580000 rw-p 00000000 00:00 0
2eb7705c9000-2eb770600000 ---p 00000000 00:00 0
2eb770600000-2eb770603000 rw-p 00000000 00:00 0
2eb770603000-2eb770604000 ---p 00000000 00:00 0
2eb770604000-2eb77062d000 rwxp 00000000 00:00 0
2eb77062d000-2eb770680000 ---p 00000000 00:00 0
2eb770680000-2eb770683000 rw-p 00000000 00:00 0
2eb770683000-2eb770684000 ---p 00000000 00:00 0
2eb770684000-2eb7706ad000 rwxp 00000000 00:00 0
2eb7706ad000-2eb770700000 ---p 00000000 00:00 0
2eb770700000-2eb770703000 rw-p 00000000 00:00 0
2eb770703000-2eb770704000 ---p 00000000 00:00 0
2eb770704000-2eb77072d000 rwxp 00000000 00:00 0
2eb77072d000-2eb770780000 ---p 00000000 00:00 0
2eb770780000-2eb770783000 rw-p 00000000 00:00 0
2eb770783000-2eb770784000 ---p 00000000 00:00 0
2eb770784000-2eb7707ff000 rwxp 00000000 00:00 0
2eb7707ff000-2eb770800000 ---p 00000000 00:00 0
2eb770800000-2eb770803000 rw-p 00000000 00:00 0
2eb770803000-2eb770804000 ---p 00000000 00:00 0
2eb770804000-2eb77087f000 rwxp 00000000 00:00 0
2eb77087f000-2eb770880000 ---p 00000000 00:00 0
2eb770880000-2eb770883000 rw-p 00000000 00:00 0
2eb770883000-2eb770884000 ---p 00000000 00:00 0
2eb770884000-2eb7708ff000 rwxp 00000000 00:00 0
2eb7708ff000-2eb770900000 ---p 00000000 00:00 0
2eb770900000-2eb770903000 rw-p 00000000 00:00 0
2eb770903000-2eb770904000 ---p 00000000 00:00 0
2eb770904000-2eb77097f000 rwxp 00000000 00:00 0
2eb77097f000-2eb7905c9000 ---p 00000000 00:00 0
2f5394200000-2f5394280000 rw-p 00000000 00:00 0
3107f7500000-3107f7505000 rw-p 00000000 00:00 0
33ff9cd80000-33ff9ce00000 rw-p 00000000 00:00 0
346461a80000-346461b00000 rw-p 00000000 00:00 0
356ab6e00000-356ab6e80000 rw-p 00000000 00:00 0
371f27000000-371f27080000 rw-p 00000000 00:00 0
3a3864780000-3a3864800000 rw-p 00000000 00:00 0
3a59e6580000-3a59e6600000 rw-p 00000000 00:00 0
3e2ec1100000-3e2ec1180000 rw-p 00000000 00:00 0
3f8130797000-3f8130798000 ---p 00000000 00:00 0
3f8130798000-3f81307a0000 rw-p 00000000 00:00 0
3f81307a0000-3f81307a3000 ---p 00000000 00:00 0
7fe494000000-7fe494021000 rw-p 00000000 00:00 0
7fe494021000-7fe498000000 ---p 00000000 00:00 0
7fe49c000000-7fe49c021000 rw-p 00000000 00:00 0
7fe49c021000-7fe4a0000000 ---p 00000000 00:00 0
7fe4a0000000-7fe4a0021000 rw-p 00000000 00:00 0
7fe4a0021000-7fe4a4000000 ---p 00000000 00:00 0
7fe4a4000000-7fe4a4050000 rw-p 00000000 00:00 0
7fe4a4050000-7fe4a8000000 ---p 00000000 00:00 0
7fe4aa6e6000-7fe4aa724000 r-xp 00000000 fc:00 279057                     /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7fe4aa724000-7fe4aa923000 ---p 0003e000 fc:00 279057                     /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7fe4aa923000-7fe4aa924000 r--p 0003d000 fc:00 279057                     /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7fe4aa924000-7fe4aa925000 rw-p 0003e000 fc:00 279057                     /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7fe4aa925000-7fe4aaa4e000 r-xp 00000000 fc:00 281769                     /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7fe4aaa4e000-7fe4aac4d000 ---p 00129000 fc:00 281769                     /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7fe4aac4d000-7fe4aac4e000 r--p 00128000 fc:00 281769                     /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7fe4aac4e000-7fe4aac50000 rw-p 00129000 fc:00 281769                     /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7fe4aac50000-7fe4aafe7000 r-xp 00000000 fc:00 281808                     /usr/lib/atlas-base/libatlas.so.3.0
7fe4aafe7000-7fe4ab1e7000 ---p 00397000 fc:00 281808                     /usr/lib/atlas-base/libatlas.so.3.0
7fe4ab1e7000-7fe4ab1ee000 rw-p 00397000 fc:00 281808                     /usr/lib/atlas-base/libatlas.so.3.0
7fe4ab1ee000-7fe4ab20f000 r-xp 00000000 fc:00 281809                     /usr/lib/atlas-base/libcblas.so.3.0
7fe4ab20f000-7fe4ab40f000 ---p 00021000 fc:00 281809                     /usr/lib/atlas-base/libcblas.so.3.0
7fe4ab40f000-7fe4ab410000 rw-p 00021000 fc:00 281809                     /usr/lib/atlas-base/libcblas.so.3.0
7fe4ab410000-7fe4ab4c0000 r-xp 00000000 fc:00 305475                     /home/piotr/voicerecognition/node_modules/snowboy/lib/node/binding/Release/node-v59-linux-x64/snowboy.node
7fe4ab4c0000-7fe4ab6c0000 ---p 000b0000 fc:00 305475                     /home/piotr/voicerecognition/node_modules/snowboy/lib/node/binding/Release/node-v59-linux-x64/snowboy.node
7fe4ab6c0000-7fe4ab6c2000 r--p 000b0000 fc:00 305475                     /home/piotr/voicerecognition/node_modules/snowboy/lib/node/binding/Release/node-v59-linux-x64/snowboy.node
7fe4ab6c2000-7fe4ab6c5000 rw-p 000b2000 fc:00 305475                     /home/piotr/voicerecognition/node_modules/snowboy/lib/node/binding/Release/node-v59-linux-x64/snowboy.node
7fe4ab6c5000-7fe4ab6c7000 rw-p 00000000 00:00 0
7fe4ab6c7000-7fe4ab6c8000 ---p 00000000 00:00 0
7fe4ab6c8000-7fe4abec8000 rw-p 00000000 00:00 0
7fe4abec8000-7fe4abec9000 ---p 00000000 00:00 0
7fe4abec9000-7fe4ac6c9000 rw-p 00000000 00:00 0
7fe4ac6c9000-7fe4ac6ca000 ---p 00000000 00:00 0
7fe4ac6ca000-7fe4aceca000 rw-p 00000000 00:00 0
7fe4aceca000-7fe4acecb000 ---p 00000000 00:00 0
7fe4acecb000-7fe4ad6cb000 rw-p 00000000 00:00 0
7fe4ad6cb000-7fe4ad88b000 r-xp 00000000 fc:00 390647                     /lib/x86_64-linux-gnu/libc-2.23.so
7fe4ad88b000-7fe4ada8b000 ---p 001c0000 fc:00 390647                     /lib/x86_64-linux-gnu/libc-2.23.so
7fe4ada8b000-7fe4ada8f000 r--p 001c0000 fc:00 390647                     /lib/x86_64-linux-gnu/libc-2.23.so
7fe4ada8f000-7fe4ada91000 rw-p 001c4000 fc:00 390647                     /lib/x86_64-linux-gnu/libc-2.23.so
7fe4ada91000-7fe4ada95000 rw-p 00000000 00:00 0
7fe4ada95000-7fe4adaad000 r-xp 00000000 fc:00 390734                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fe4adaad000-7fe4adcac000 ---p 00018000 fc:00 390734                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fe4adcac000-7fe4adcad000 r--p 00017000 fc:00 390734                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fe4adcad000-7fe4adcae000 rw-p 00018000 fc:00 390734                     /lib/x86_64-linux-gnu/libpthread-2.23.so
7fe4adcae000-7fe4adcb2000 rw-p 00000000 00:00 0
7fe4adcb2000-7fe4adcc8000 r-xp 00000000 fc:00 390673                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fe4adcc8000-7fe4adec7000 ---p 00016000 fc:00 390673                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fe4adec7000-7fe4adec8000 rw-p 00015000 fc:00 390673                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fe4adec8000-7fe4adfd0000 r-xp 00000000 fc:00 390688                     /lib/x86_64-linux-gnu/libm-2.23.so
7fe4adfd0000-7fe4ae1cf000 ---p 00108000 fc:00 390688                     /lib/x86_64-linux-gnu/libm-2.23.so
7fe4ae1cf000-7fe4ae1d0000 r--p 00107000 fc:00 390688                     /lib/x86_64-linux-gnu/libm-2.23.so
7fe4ae1d0000-7fe4ae1d1000 rw-p 00108000 fc:00 390688                     /lib/x86_64-linux-gnu/libm-2.23.so
7fe4ae1d1000-7fe4ae343000 r-xp 00000000 fc:00 262695                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fe4ae343000-7fe4ae543000 ---p 00172000 fc:00 262695                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fe4ae543000-7fe4ae54d000 r--p 00172000 fc:00 262695                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fe4ae54d000-7fe4ae54f000 rw-p 0017c000 fc:00 262695                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fe4ae54f000-7fe4ae553000 rw-p 00000000 00:00 0
7fe4ae553000-7fe4ae55a000 r-xp 00000000 fc:00 390740                     /lib/x86_64-linux-gnu/librt-2.23.so
7fe4ae55a000-7fe4ae759000 ---p 00007000 fc:00 390740                     /lib/x86_64-linux-gnu/librt-2.23.so
7fe4ae759000-7fe4ae75a000 r--p 00006000 fc:00 390740                     /lib/x86_64-linux-gnu/librt-2.23.so
7fe4ae75a000-7fe4ae75b000 rw-p 00007000 fc:00 390740                     /lib/x86_64-linux-gnu/librt-2.23.so
7fe4ae75b000-7fe4ae75e000 r-xp 00000000 fc:00 390661                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fe4ae75e000-7fe4ae95d000 ---p 00003000 fc:00 390661                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fe4ae95d000-7fe4ae95e000 r--p 00002000 fc:00 390661                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fe4ae95e000-7fe4ae95f000 rw-p 00003000 fc:00 390661                     /lib/x86_64-linux-gnu/libdl-2.23.so
7fe4ae95f000-7fe4ae985000 r-xp 00000000 fc:00 390623                     /lib/x86_64-linux-gnu/ld-2.23.so
7fe4aeb76000-7fe4aeb7d000 rw-p 00000000 00:00 0
7fe4aeb7f000-7fe4aeb80000 rw-p 00000000 00:00 0
7fe4aeb80000-7fe4aeb81000 ---p 00000000 00:00 0
7fe4aeb81000-7fe4aeb84000 rw-p 00000000 00:00 0
7fe4aeb84000-7fe4aeb85000 r--p 00025000 fc:00 390623                     /lib/x86_64-linux-gnu/ld-2.23.so
7fe4aeb85000-7fe4aeb86000 rw-p 00026000 fc:00 390623                     /lib/x86_64-linux-gnu/ld-2.23.so
7fe4aeb86000-7fe4aeb87000 rw-p 00000000 00:00 0
7ffea82a1000-7ffea82c2000 rw-p 00000000 00:00 0                          [stack]
7ffea82c8000-7ffea82cb000 r--p 00000000 00:00 0                          [vvar]
7ffea82cb000-7ffea82cd000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)

EDIT: After downgrading snowboy to 1.2.0 everything works as intended.

ScottishCyclops commented 6 years ago

Experiencing similar issue. 1.2.0 works fine.