Is this a crash in Corona? (Please see this console log)

When testing with an iPhone, my app keeps crashing in a certain scenario. Please see the console log when it happens:

Sep 7 15:00:07 myiPhone myApp1405[5291] \<Warning\>: Runtime error &nbsp;&nbsp;&nbsp;&nbsp;?:0: attempt to compare number with nil &nbsp;&nbsp;&nbsp;&nbsp;stack traceback: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[C]: ? &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function '\_listener' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function \<?:141\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function \<?:218\> Sep 7 15:00:08 myiPhone myApp1405[5291] \<Warning\>: RuntimeErrorNotification: Runtime error: ?:0: attempt to compare number with nil &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;stack traceback: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[C]: ? &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function '\_listener' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function \<?:141\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function \<?:218\> Sep 7 15:00:08 myiPhone myApp1405[5291] \<Warning\>: Runtime error &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;stack traceback: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[C]: ? &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function '\_listener' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function \<?:141\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function \<?:218\> Sep 7 15:00:08 myiPhone myApp1405[5291] \<Warning\>: RuntimeErrorNotification: Runtime error: &nbsp;&nbsp;&nbsp;&nbsp;stack traceback: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[C]: ? &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function '\_listener' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function \<?:141\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?: in function \<?:218\>

I have been commenting out my code to narrow down where it might cause the crash, but I can’t find anything. Usually if the crash happens in my code, it shows the source filename. However, in this case, it only shows “question mark”

Any idea? Any suggestion?

Thanks.

:)  

Yes, that is a Corona crash.  Once you build for device you loose access to the symbols that tell you the filename and variable names, which is why you get the ? marks.  I would suggest putting some “print” statements in around where you think this is happening to try and narrow it down.  Does it happen after you tap the screen?  Does it take off right away?  Does it loop endlessly or happen a fixed number of time?  Does it happen when changing screens?

We can tell that its around a listener, so its like your maybe passing a nil to a listener function or a nil as an event table or target.

Thanks. I put a workaround to prevent this crash happen.

Just another question, is fault tolerance something Corona SDK is trying to achieve?

Yes we try to trap crashes, but when I say crash I’m talking about things like Segment Violations.  This is us catching you trying to pass something in that you are not supposed to.

What was your work around?  Did you find out where the problem was happening?  I’d rather see you try and fix the actual problem than working around it.

Yes, I want to fix the actual problem instead of a workaround, of course. :slight_smile:

I did try to comment out blocks of code here and there to find out the exact place where the crash could happen.

However, I can’t find it out. Here is my situation:

I have an app that listens to a touch event. So when a user touches/swipes the screen, my touch listener moves the images, just like “flipping” pages in horizontal movements.

And everything works perfect except one scenario. If I swipes the screen ultra fast, the crash happens (always).

My final solution is to put a conditional flag, whenever a touch screen “begins”, the flag set to 1, and it is set to 0 with a delay of 1 ms when touch event is in ending phase, 

timer.performWithDelay(1, function() myFlag = 0 end ) &nbsp;

When my touch listener gets an event in “began” phase, if the flag is 1, I will ignore the event. So the delay is kind of like, after the touch event is ended, delay one millisecond before the next new touch event to be handled.

Without this workaround, it always crashes when I swipe the screen fast. With this flag that delays just one millisecond, the crash doesn’t happen at all without sacrificing much. 

:)  

Yes, that is a Corona crash.  Once you build for device you loose access to the symbols that tell you the filename and variable names, which is why you get the ? marks.  I would suggest putting some “print” statements in around where you think this is happening to try and narrow it down.  Does it happen after you tap the screen?  Does it take off right away?  Does it loop endlessly or happen a fixed number of time?  Does it happen when changing screens?

We can tell that its around a listener, so its like your maybe passing a nil to a listener function or a nil as an event table or target.

Thanks. I put a workaround to prevent this crash happen.

Just another question, is fault tolerance something Corona SDK is trying to achieve?

Yes we try to trap crashes, but when I say crash I’m talking about things like Segment Violations.  This is us catching you trying to pass something in that you are not supposed to.

What was your work around?  Did you find out where the problem was happening?  I’d rather see you try and fix the actual problem than working around it.

Yes, I want to fix the actual problem instead of a workaround, of course. :slight_smile:

I did try to comment out blocks of code here and there to find out the exact place where the crash could happen.

However, I can’t find it out. Here is my situation:

I have an app that listens to a touch event. So when a user touches/swipes the screen, my touch listener moves the images, just like “flipping” pages in horizontal movements.

And everything works perfect except one scenario. If I swipes the screen ultra fast, the crash happens (always).

My final solution is to put a conditional flag, whenever a touch screen “begins”, the flag set to 1, and it is set to 0 with a delay of 1 ms when touch event is in ending phase, 

timer.performWithDelay(1, function() myFlag = 0 end ) &nbsp;

When my touch listener gets an event in “began” phase, if the flag is 1, I will ignore the event. So the delay is kind of like, after the touch event is ended, delay one millisecond before the next new touch event to be handled.

Without this workaround, it always crashes when I swipe the screen fast. With this flag that delays just one millisecond, the crash doesn’t happen at all without sacrificing much. 

I am also getting this problem. Not sure whether this is a bug or not.

After drilling down, i notice it occurs when (storyboard) :

  1. scrollView is populated with ‘data’ (items are added to ‘scrollViewObject:insert(item)’ )

  2. Straight-away, remove the scrollView object ( scrollViewObject:removeSelf() )

My guess is that the scrollView is doing some background work on the simulator & device side (yes, it crashes on the iPhone too).

The data in the scrollView may be too much (it contains images, text, to make it look like tableView), and it is taking a longer time to remove those items.

The error looks like this :

11-01 20:13:55.832 Corona Simulator[40988:707] Runtime error ?:0: attempt to compare number with nil stack traceback: [C]: ? ?: in function '\_listener' ?: in function \<?:141\> ?: in function \<?:218\>

Have you tried this with the latest daily build?

I am also getting this problem. Not sure whether this is a bug or not.

After drilling down, i notice it occurs when (storyboard) :

  1. scrollView is populated with ‘data’ (items are added to ‘scrollViewObject:insert(item)’ )

  2. Straight-away, remove the scrollView object ( scrollViewObject:removeSelf() )

My guess is that the scrollView is doing some background work on the simulator & device side (yes, it crashes on the iPhone too).

The data in the scrollView may be too much (it contains images, text, to make it look like tableView), and it is taking a longer time to remove those items.

The error looks like this :

11-01 20:13:55.832 Corona Simulator[40988:707] Runtime error ?:0: attempt to compare number with nil stack traceback: [C]: ? ?: in function '\_listener' ?: in function \<?:141\> ?: in function \<?:218\>

Have you tried this with the latest daily build?

I ran into the same issue and noticed it was because I was populating a scrollview in the “will” phase. Because of this it caused the horizontal slide to have some issue which caused this lua exception.  The fix for me was to move the code into the “did” phase after the movement was complete. I just put in a “loading” while displaying my text.

I ran into the same issue and noticed it was because I was populating a scrollview in the “will” phase. Because of this it caused the horizontal slide to have some issue which caused this lua exception.  The fix for me was to move the code into the “did” phase after the movement was complete. I just put in a “loading” while displaying my text.

I am encountering this exact same error.
I am having a scrollview and I think this error happens after the scrollview is removed (when I change scene). I use director class.

Why is this error occurring?
I am using Build 2234
 

P.S  The stacktrace gives no information on line numbers or function names or anything, so am unable to pinpoint the error…

As far as I know the Director class isn’t compatible with Graphics 2.0.

For new projects I’d recommend using Corona’s composer.* API. I’d also recommend upgrading older projects as the Director class isn’t in active development anymore. The latest version is from Aug 2011 and a lot has changed in Corona since then.

Really? I have apps live in the stores, which use director AND graphics 2.0. Have gotten no issues till now… Unless that is, this one is a director class error… 

Is it possible that this error might be caused by director class? I really don’t want to port my code unless I’m sure that is what is causing the error. 

That aside, I’d really like to know what is actually causing the error.
Can anyone from Corona staff shed light on this?