Endless runtime error loop when using timers

Hi,
I have encountered a strange behavior when using timers. Any function, that contains an error and is called with a timer, triggers an endless runtime error loop. Here is an example code:

-- triggers only one error
local t = 100 + false  

-- triggers an endless error loop
local function listener( event )
    local t = 100 + false
end      
timer.performWithDelay( 1000, listener )

-- triggers an endless error loop
timer.performWithDelay(1000, function()
    local t = 100 + false    
end, 1)

To recreate this on simulator, you have to use Runtime:hideErrorAlerts() or unhandledError listener that returns true, but for production build, this is on by default. Test each code block separately, so that the runtime doesn’t stop at the firs error.

Is this a bug or am I missing something? I don’t remember this behavior in the past. I am using the latest build (2020.3635)

Thanks!

I’m using the same version of Solar2D and the app crashes, just as expected. Once the app has crashed, it’s down and won’t crash again.

Are you experiencing this on some specific platform, like HTML5?

This happens on simulator and with android build. For simulator, you have to use Runtime:hideErrorAlerts() or unhandledError listener that returns true, but for production build, this is on by default.

If you want to recreate it, comment the first line so that the runtime doesn’t stop at the first error.

Seems like there’s an issue posted about this on GitHub as well.

I’m fairly certain I know what the issue is. While runtime errors like that should be fixed elsewhere, i.e. you shouldn’t allow your application to crash to begin with, I’m working on fixing one other issue in the framework and I’ll add this to the list so that your app will only encounter one runtime error per timer afterwards.

Don’t worry, I’m not really putting “local t = 100 + false” in my code. :slight_smile: I try to take care of my errors, however, I don’t think this is the intended engine behavior, that’s why I created the post.

@XeduR, thank you for looking into this!

Well, just to clarify for you two gents:

What I implicitly said was that if a developer has a runtime error in their project that they should address that runtime error instead of looking to address the aftermath of the runtime error.

You are adding a Boolean value to an Integer. Surely it is an error.

My app worked perfectly on the sim and it was a just black screen on android. Tough one to just figure out. Turns out doing string manipulations on textbox.string was a problem on android. If I copied the string to a temporary one and back it worked. I love Solar 2D and I love fixing bugs so this all works out.

This is affecting me too. Build 3622 works fine - it spits out an error and shuts up. But later builds (including 3638, the latest), spew endless errors and lock up my machine.

Anyone have a quick solution or do we need to wait for a proper fix to revert to 3622-behaviour?