JUCE
JUCE copied to clipboard
[Bug]: [Juce8 / QuickJS] Random but inevitable script stopping with error "interrupted"
Detailed steps on how to reproduce the bug
I have this very simple script, the function "update" is called in a dedicated thread at 100fps.
function update(deltaTime) {
for (var i = 0; i < 100; i++) {
}
}
Eventually, this code will stop, the returned error code being "interrupted".
This is the stack trace when breaking at the throwing of this interruption :
> Chataigne.exe!`anonymous namespace'::choc::javascript::quickjs::__js_poll_interrupts(`anonymous-namespace'::choc::javascript::quickjs::JSContext * ctx) Line 16707 C++
Chataigne.exe!`anonymous namespace'::choc::javascript::quickjs::js_poll_interrupts(`anonymous-namespace'::choc::javascript::quickjs::JSContext * ctx) Line 16718 C++
Chataigne.exe!`anonymous namespace'::choc::javascript::quickjs::JS_CallInternal(`anonymous-namespace'::choc::javascript::quickjs::JSContext * caller_ctx, `anonymous-namespace'::choc::javascript::quickjs::JSValue func_obj, `anonymous-namespace'::choc::javascript::quickjs::JSValue this_obj, `anonymous-namespace'::choc::javascript::quickjs::JSValue new_target, int argc, `anonymous-namespace'::choc::javascript::quickjs::JSValue * argv, int flags) Line 27286 C++
Chataigne.exe!`anonymous namespace'::choc::javascript::quickjs::JS_CallFree(`anonymous-namespace'::choc::javascript::quickjs::JSContext * ctx, `anonymous-namespace'::choc::javascript::quickjs::JSValue func_obj, `anonymous-namespace'::choc::javascript::quickjs::JSValue this_obj, int argc, `anonymous-namespace'::choc::javascript::quickjs::JSValue * argv) Line 28655 C++
Chataigne.exe!`anonymous namespace'::choc::javascript::quickjs::JS_Invoke(`anonymous-namespace'::choc::javascript::quickjs::JSContext * ctx, `anonymous-namespace'::choc::javascript::quickjs::JSValue this_val, unsigned int atom, int argc, `anonymous-namespace'::choc::javascript::quickjs::JSValue * argv) Line 28809 C++
Chataigne.exe!juce::JavascriptEngine::Impl::callFunction(const juce::Identifier & function, const juce::var::NativeFunctionArgs & args, juce::Result * errorMessage) Line 736 C++
Chataigne.exe!juce::JavascriptEngine::callFunction(const juce::Identifier & function, const juce::var::NativeFunctionArgs & args, juce::Result * errorMessage) Line 802 C++
Chataigne.exe!Script::callFunction(const juce::Identifier & function, const juce::Array<juce::var,juce::DummyCriticalSection,0> args, juce::Result * result) Line 288 C++
Chataigne.exe!Script::run() Line 399 C++
Chataigne.exe!juce::Thread::threadEntryPoint() Line 110 C++
Chataigne.exe!juce::juce_threadEntryPoint(void * userData) Line 132 C++
Chataigne.exe!juce::threadEntryProc(void * userData) Line 75 C++
In the js_poll_interrupts function, the ctx->interrupt_counter has a value of 10000, same value in multiple runs
changing the loop count to 1 makes it run more before crashing removing the for loop and keeping just the update function seems to be ok, but it could also mean that it would run way more before crashing.
EDIT : I let the script live a bit longer with only the update() function and it ended up crashing as well, same error
What is the expected behaviour?
No interrupt, or at least a more informative error message. But with the minimalism of this code, I'd rather hope for no crash :)
Operating systems
Windows
What versions of the operating systems?
Win 11
Architectures
64-bit
Stacktrace
No response
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the develop
branch
The bug is present on the develop
branch
Code of Conduct
- [X] I agree to follow the Code of Conduct