HTTP calls crashing HISE
-
Thanks,
I have no idea what to look for. So here's everything that's red haha.
-
@aaronventure the only thing I can see is that the connection is being refused, and maybe a crash occurs if that isn't handled. What does the Server Controller show when this is happening?
-
@aaronventure I wish I could help, man. I can offer this - HISE doesn't always check to see if you've made a mistake in an API call or such. This makes sense, because every such check slows down HISE. Plus, it takes lots of time to implement all that stuff. Almost every crash I've had was because I made such a mistake.
-
Are you building a ddos generator?
-
The weird thing is that it all works. Maybe I'm calling too often but it works as expected in HISE
@d-healey haha isn't rate limiting a single ip a thing from 20 years ago?
Hey can you check this pdf real quick.
-
@aaronventure the debugger locations hint at some race condition between variables being used on the server thread after they have been destroyed by the script (eg references to local JSON objects). Can you dumb that down to an example that crashes more or less reliably?
-
@Christoph-Hart I can't get it to reliably crash, sometimes it's in 5 seconds, other times it's 5 minutes. There's no branching beyond if (status == 200).
I do have inline functions which then store server call methods. Should I not be interacting with the locals created in these inline functions?
Is the lifetime of the inline function in this case just until it fires the method or until the actual response from the server comes back?
-
@aaronventure alright I dropped all arguments from inline functions, made them into standard functions and removed any local/var from the functions: they now just call the server method and the function for the server method is written right in it (it's not defined outside of the server method and then passed)
Still crashing. Server Controller showing all green.
I'm calling localhost on 5000 if that matters anything.
-
I'm able to work around this by using runProcess to call curl and send out HTTP calls that way. That also gives me access to the DELETE and PUT calls as well.
Is there any reason why this would be a bad idea? macOS has had curl since 2001 and Windows has had curl since 2019. I guess that would be the only downside, i.e. I'd have to ship curl for older versions of windows along with the app.
-
@Christoph-Hart so apparently the curl processes are causing crashes now, too. Worth mentioning i'm on macOS. Are the macOS crash logs of any worth to you?
Thread 18 Crashed:: Get Pos Data 0 libsystem_kernel.dylib 0x1894eba38 __close_nocancel + 8 1 libsystem_c.dylib 0x1893df120 fclose + 144 2 HISE 0x10540f1d8 hise::ScriptingObjects::ScriptBackgroundTask::run() + 1920 3 HISE 0x1061fe2e4 juce::threadEntryProc(void*) + 284 4 libsystem_pthread.dylib 0x18952af94 _pthread_start + 136 5 libsystem_pthread.dylib 0x189525d34 thread_start + 8 Thread 18 crashed with ARM Thread State (64-bit): x0: 0x0000000000000001 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000600001bdad40 x4: 0x0000000002000004 x5: 0x0000000000000019 x6: 0x0000000000000000 x7: 0x00000001894e3ad4 x8: 0x00000001893df1a8 x9: 0x00000001f136f2d0 x10: 0x00000001f136c7c0 x11: 0x000000000023c7c7 x12: 0x0000000000000001 x13: 0x0000000000000000 x14: 0x0000000000000002 x15: 0x00000000000000b5 x16: 0x000000000000018f x17: 0x00000001fb719a90 x18: 0x0000000000000000 x19: 0x0000000000000000 x20: 0x00000001f136d538 x21: 0x0000000000000000 x22: 0x00000000ffffffff x23: 0x000000016c946f08 x24: 0x0000000106a6b000 x25: 0x000000016c946ee8 x26: 0x000000016c946f18 x27: 0x000000014d500670 x28: 0x000000010687aa30 fp: 0x000000016c946e60 lr: 0x00000001893df120 sp: 0x000000016c946e40 pc: 0x00000001894eba38 cpsr: 0xa0001000 far: 0x0000000000000000 esr: 0x56000080 Address size fault
And it's always this line
0 libsystem_kernel.dylib 0x1894eba38 __close_nocancel + 8
Some other times it crashes on a different task
Thread 18 Crashed:: Get Mass Data 0 libsystem_kernel.dylib 0x1894f2a60 __pthread_kill + 8 1 libsystem_pthread.dylib 0x18952ac20 pthread_kill + 288 2 libsystem_c.dylib 0x189437a30 abort + 180 3 libsystem_malloc.dylib 0x189347dc4 malloc_vreport + 896 4 libsystem_malloc.dylib 0x18934b430 malloc_report + 64 5 libsystem_malloc.dylib 0x189365494 find_zone_and_free + 528 6 HISE 0x1059f690c juce::NamedValueSet::set(juce::Identifier const&, juce::var const&) + 364 7 HISE 0x104baf328 hise::HiseJavascriptEngine::RootObject::ArraySubscript::assign(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var const&) const + 1076 8 HISE 0x104b979c4 hise::HiseJavascriptEngine::RootObject::Assignment::getResult(hise::HiseJavascriptEngine::RootObject::Scope const&) const + 72 9 HISE 0x104b946b4 hise::HiseJavascriptEngine::RootObject::Expression::perform(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 36 10 HISE 0x104bd5f8c hise::HiseJavascriptEngine::RootObject::BlockStatement::performWithinScope(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 644 11 HISE 0x104bbc430 hise::HiseJavascriptEngine::RootObject::LoopStatement::perform(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 188 12 HISE 0x104bd5f8c hise::HiseJavascriptEngine::RootObject::BlockStatement::performWithinScope(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 644 13 HISE 0x104bbd2c8 hise::HiseJavascriptEngine::RootObject::IfStatement::perform(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 116 14 HISE 0x104bd5f8c hise::HiseJavascriptEngine::RootObject::BlockStatement::performWithinScope(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 644 15 HISE 0x104bbd2c8 hise::HiseJavascriptEngine::RootObject::IfStatement::perform(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 116 16 HISE 0x104bd5f8c hise::HiseJavascriptEngine::RootObject::BlockStatement::performWithinScope(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 644 17 HISE 0x104bbd2c8 hise::HiseJavascriptEngine::RootObject::IfStatement::perform(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 116 18 HISE 0x104bd5f8c hise::HiseJavascriptEngine::RootObject::BlockStatement::performWithinScope(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 644 19 HISE 0x104bb3738 hise::HiseJavascriptEngine::RootObject::FunctionObject::invoke(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var::NativeFunctionArgs const&) const + 968 20 HISE 0x104bc0eec hise::HiseJavascriptEngine::callExternalFunctionRaw(juce::var, juce::var::NativeFunctionArgs const&) + 604 21 HISE 0x104bc0830 hise::HiseJavascriptEngine::callExternalFunction(juce::var, juce::var::NativeFunctionArgs const&, juce::Result*, bool) + 280 22 HISE 0x104bc007c hise::WeakCallbackHolder::CallableObject::call(hise::HiseJavascriptEngine*, juce::var::NativeFunctionArgs const&, juce::var*) + 164 23 HISE 0x104b84a90 hise::WeakCallbackHolder::callSync(juce::var::NativeFunctionArgs const&, juce::var*) + 224 24 HISE 0x104b8a8c8 hise::WeakCallbackHolder::callSync(juce::var*, int, juce::var*) + 200 25 HISE 0x104c16d4c hise::ScriptingObjects::ScriptBackgroundTask::ChildProcessData::callLog(juce::var*) + 76 26 HISE 0x104c1512c hise::ScriptingObjects::ScriptBackgroundTask::run() + 1556 27 HISE 0x105a027b4 juce::threadEntryProc(void*) + 284 28 libsystem_pthread.dylib 0x18952af94 _pthread_start + 136 29 libsystem_pthread.dylib 0x189525d34 thread_start + 8 Thread 18 crashed with ARM Thread State (64-bit): x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000 x4: 0x0000000000000073 x5: 0x000000000000002e x6: 0x0000000000000001 x7: 0x0000000000000000 x8: 0xc0abdd86d76c12ee x9: 0xc0abdd87bcdda2ee x10: 0x000000000000000a x11: 0x0000000000000000 x12: 0x0000000000000035 x13: 0x0000000000000000 x14: 0x000000012b100000 x15: 0x0000000000000000 x16: 0x0000000000000148 x17: 0x00000001fb719928 x18: 0x0000000000000000 x19: 0x0000000000000006 x20: 0x000000016bb1b000 x21: 0x0000000000001147 x22: 0x000000016bb1b0e0 x23: 0x000000016bb1a430 x24: 0x0000000000000000 x25: 0x0000000000000000 x26: 0x000000016ba07c4b x27: 0x000000016bb1b000 x28: 0x0000000106275000 fp: 0x000000016bb19d80 lr: 0x000000018952ac20 sp: 0x000000016bb19d60 pc: 0x00000001894f2a60 cpsr: 0x40001000 far: 0x0000000000000000 esr: 0x56000080 Address size fault
Another example
Crashed Thread: 2 Javascript Thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0xfffffffffffffff0 Exception Codes: 0x0000000000000001, 0xfffffffffffffff0 Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Thread 2 Crashed:: Javascript Thread 0 libc++abi.dylib 0x1894e27b0 __dynamic_cast + 56 1 HISE 0x104974238 hise::HiseJavascriptEngine::RootObject::IsDefinedTest::getResult(hise::HiseJavascriptEngine::RootObject::Scope const&) const + 44 2 HISE 0x1049a74e4 hise::HiseJavascriptEngine::RootObject::LogicalAndOp::getResult(hise::HiseJavascriptEngine::RootObject::Scope const&) const + 56 3 HISE 0x1049a74e4 hise::HiseJavascriptEngine::RootObject::LogicalAndOp::getResult(hise::HiseJavascriptEngine::RootObject::Scope const&) const + 56 4 HISE 0x10498928c hise::HiseJavascriptEngine::RootObject::IfStatement::perform(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 56 5 HISE 0x1049a1f8c hise::HiseJavascriptEngine::RootObject::BlockStatement::performWithinScope(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 644 6 HISE 0x1049892c8 hise::HiseJavascriptEngine::RootObject::IfStatement::perform(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 116 7 HISE 0x1049a1f8c hise::HiseJavascriptEngine::RootObject::BlockStatement::performWithinScope(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var*) const + 644 8 HISE 0x10497f738 hise::HiseJavascriptEngine::RootObject::FunctionObject::invoke(hise::HiseJavascriptEngine::RootObject::Scope const&, juce::var::NativeFunctionArgs const&) const + 968 9 HISE 0x10498ceec hise::HiseJavascriptEngine::callExternalFunctionRaw(juce::var, juce::var::NativeFunctionArgs const&) + 604 10 HISE 0x10498c830 hise::HiseJavascriptEngine::callExternalFunction(juce::var, juce::var::NativeFunctionArgs const&, juce::Result*, bool) + 280 11 HISE 0x1049ddbe0 std::__1::__function::__func<hise::ScriptingApi::Content::ScriptPanel::internalRepaint(bool)::$_152, std::__1::allocator<hise::ScriptingApi::Content::ScriptPanel::internalRepaint(bool)::$_152>, juce::Result (hise::JavascriptProcessor*)>::operator()(hise::JavascriptProcessor*&&) + 648 12 HISE 0x1049532fc hise::JavascriptThreadPool::Task::callWithResult() + 636 13 HISE 0x104b7ebfc hise::JavascriptThreadPool::executeQueue(hise::JavascriptThreadPool::Task::Type const&, juce::Array<juce::WeakReference<hise::JavascriptProcessor, juce::ReferenceCountedObject>, juce::DummyCriticalSection, 0>&) + 3340 14 HISE 0x104b7cfe4 hise::JavascriptThreadPool::run() + 132 15 HISE 0x1057ce7b4 juce::threadEntryProc(void*) + 284 16 libsystem_pthread.dylib 0x18952af94 _pthread_start + 136 17 libsystem_pthread.dylib 0x189525d34 thread_start + 8