HTTP calls crashing HISE
-
Im working on some tools and am trying to hook up HISE to continuously communicate with a server. I have a about 5 timers ranging from 1 to 10 seconds making POST and GET calls.
I'm on macOS. HISE will randomly crash while doing this. It is completely random, and I cannot pin it down. Sometimes it crashes within seconds of loading the projects (the timers start automatically) and sometimes it stays up for a few dozen minutes. As I introduced more timers, the crashing became more frequent.
How would I even debug this? Is there log for this somewhere?
-
If it's crashing HISE you'll need to build the debug version of HISE, run it from Xcode/VS and then load your project. When it crashes, it should pinpoint the line of code that failed.
-
@Dan-Korneff do I just open the .xcodeproj file and try to run it there?
-
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.