Segfault on node 10.25 OSX and Linux (Fedora 64bit)
I'm not sure if this project is in active maintenance, but you accepted my pull req for node-gyp changes so I'll file this issue. SDL is such a cool way to do sound in node.
If I play several sounds the process eventually segfaults. Sometimes this happens after the first sound and sometimes it takes a few to trigger it. It always seems to happen after about 10 calls to play().
I built my node-sdlmixer binary with debug symbols against libSDL2 although I get the same crash with SDL1. I tried this on OSX and Fedora.
test.js
var sdlmixer = require("../sdlmixer");
console.log("Opened audio at " + sdlmixer.audioRate + " Hz " + sdlmixer.audioFormat + " bit " +
sdlmixer.audioChannels + " and " + sdlmixer.numberOfAudioChannels + " channels.")
setInterval(function() {
sdlmixer.play(__dirname + '/../wavs/drums/tick.wav', function(fileName, channel) {
console.log(channel +": "+fileName + " done")
});
}, 1000);
retnex:test dan$ node test.js
Opened audio at 22050 Hz 16 bit stereo and 32 channels.
0: /Users/dan/sandbox/thirdparty/node-sdlmixer/test/../wavs/drums/tick.wav done
1: /Users/dan/sandbox/thirdparty/node-sdlmixer/test/../wavs/drums/tick.wav done
2: /Users/dan/sandbox/thirdparty/node-sdlmixer/test/../wavs/drums/tick.wav done
3: /Users/dan/sandbox/thirdparty/node-sdlmixer/test/../wavs/drums/tick.wav done
4: /Users/dan/sandbox/thirdparty/node-sdlmixer/test/../wavs/drums/tick.wav done
5: /Users/dan/sandbox/thirdparty/node-sdlmixer/test/../wavs/drums/tick.wav done
Segmentation fault: 11
GDB crash
$ gdb --args node test.js
Opened audio at 22050 Hz 16 bit stereo and 32 channels.
0: /Users/dan/sandbox/thirdparty/node-sdlmixer/test/../wavs/drums/tick.wav done
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000007600610087
0x0000000100124d8e in uv__async_event ()
(gdb)
GDB backtrace
(gdb) bt
#0 0x0000000100124d8e in uv__async_event ()
#1 0x0000000100124f16 in uv__async_io ()
#2 0x0000000100131b90 in uv__io_poll ()
#3 0x0000000100125343 in uv_run ()
#4 0x000000010000a5ed in node::Start ()
#5 0x00000001000017f4 in start ()
compiler info:
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.45.3) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
Occasionally I'll get a "Bus error 10" and a few times I have crashed in Node::StreamWrap. I can't reproduce these situations reliably though. I'll try to update this ticket if I can repro them.
Hi,
It's not in active maintenance at the moment, but I'll gladly accept any patches ofcourse.
As you might know, this module originated during an email thread on the nodejs mailinglist, but that has been a while ago (2011 it seems) and a lot has happened (in nodejs) since.
There is a bit of a wrapper that tries to allow the compilation of the module in different (native) api versions, but it might be a better strategy to have a look at the recent api and see if things need to be done slightly different.
The problem is probably related to the management of the (javascript) callback scopes or something similar.
If I remember from the email thread, there were also a couple of other modules started, I am not sure if any of those is still in active maintenance (if the bug is too tricky to track it might be easier to switch to something else).