-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native Crash #20
Comments
could you show me your node code causing this crash ? |
Thanks for the fast response. I'll try to find the exact call. It's a pretty complex project, it might take a while. |
So, I've finally found it. This is the code: const SoundMixer = require("native-sound-mixer").default;
const pollInterval = setInterval(() => {
for (const device of SoundMixer.devices) {
console.log(device, device.volume);
}
}, 500); It works find for the first 6 iterations, then in the 7th one it crashes. However, I was not able to reproduce that in a standalone example, I don't know why. It is definitely that line, though, as it works fine if I comment it out. |
Are you using the call in a multi threaded context ? It looks like the problem is the same as this one nodejs/node-addon-api#779. |
I am using Worker Threads on my application, but this library is used in the main thread. |
I might have located the problem, i'll try to fix it as soon as possible. |
Thanks in advance! |
Since the bug is not reproductible in a standalone, it will be hard to test the code on my side. I can still push the fix on develop and you can test it before I push a new version if that's ok for you 😄. Otherwise, I will push the fix to a new version on npm registry but I can't be sure it will fix the problem ... |
Sure 👍 |
It took longer than I expected, I should be done by next week I guess. |
No problem, thanks for your efforts 👍 |
I pushed something to |
Hm, I can't even reproduce the original error anymore... Very strange. However, while testing, I found that there may be a memory leak? Not sure, though. const nsm = require("native-sound-mixer").default;
let mute;
let volume;
(async () => {
while (true) {
console.log("next round")
for (let i = 0; i < 1000; i++) {
for (const device of nsm.devices) {
mute = device.mute;
volume = device.volume;
}
}
await new Promise((resolve) => { setTimeout(() => { resolve(); }, 500); });
}
})(); |
If you can't reproduce the original error, I hope it was some strange node issue. Concerning the memory leak problem, I'm currently working on it. However, due to the way node handles memory, the memory should be flushed regularly, fixing the memory leak as it goes. |
I agree 👍
Thanks a lot |
The memory leaks concerning the devices should be fixed on develop (for windows only) |
Yes, can confirm that the memory leak is gone 👍 Thanks for your effort. |
Hi, when trying to use this lib on a Windows 10 machine, my application crashed with the following error:
Any idea?
The text was updated successfully, but these errors were encountered: