Sporadic Error

Hey,

I have just made some major changes to my code and am getting the following error on occasion (the simulator completely exits). Does anyone know what exit code -11 is?  I am wondering if it is a corona issue, or  I have screwed up my coding.

I know this is really hard to say, but my code is large now, and I would rather continue with these changes if possible and not go back to previous version.

[Finished in 15.8s with exit code -11]

[cmd: [’/Applications/CoronaSDK/Corona Simulator.app/Contents/MacOS/Corona Simulator’, ‘-singleton’, ‘1’, ‘-no-console’, ‘1’, ‘/Users/--------/Google Drive/Corona Projects/Car Game/Car Game - Working Dir/main.lua’]]

[dir: /Users/cbriggsnz/Google Drive/Corona Projects/Car Game/Car Game - Working Dir/scripts/builders]

[path: /usr/bin:/bin:/usr/sbin:/sbin]

Cheers,

Craig

Hmm. Can you put in your whole console error code? 

Have you tried adding print statements to try seeing if you have some serious memory leaks or bugs?

–SonicX278

That is the whole error from sublime console, and print statements dont help as it seems to always happy at a different spot.

Cheers,

Craig

Just found the problem report hiding behind everything when I did a restart,  I have attached it as a txt file.

Thanks.

Hi all,

I have pinned it down to the fact I am using physics.stop().

I have read that this can be problematic, however it puts me in rather a difficult situation.  In my game the player can switch between design mode and play mode.  I am stopping physics (as opposed to physics.pause) because it removes the problem of the physics bodies moving slightly when I run physics.start().  Accuracy is important in this case.

Does anyway know how to prevent this error with physics.stop(), or another way of stopping the physics twitch when restarting?

Cheers,

Craig

Hi Craig,

When exactly are you calling physics.stop()? Are you calling it during a collision or something? Are you still working out physics math or are bodies still “resolving”?

As for using pause(), if you continue to, there are typically ways to ensure that objects don’t shift/move after you resume. Are you setting all object velocities to 0,0 before you pause? Are you using joints which might be exerting some new force after resume?

Brent

Hi Brent,

I have been playing around for this for some time so far…  

I am calling "physics.stop() when the reset button is pressed, I had/have things working in the following order.

  1. Removed any event listeners or timers (I know this should have been done anyway when the object gets removed.

  2. Waited 2 milliseconds

  3. Physics.stop()

4. Waited 2 milliseconds

  1. physics.start()  

  2. physics.pause() 

  3. Removed the objects (removed the layer they were all in)

  4. Redrew the objects to reset their positions

  5. Added physics to new objects

I then set a timer that would constantly simulate pressing the reset button (with a  200 ms delay) and found that

By adding step 1 and 2 I was able to make it a lot more stable, it would sometimes loop for 5 seconds, sometimes 1 minute (before steps 1 and 2 it would always bomb within 10 seconds). 

However I have changed it from stop to pause and it has been looping for the last 25 minutes (and counting) without an issue.  I think I will go with physics.pause(), I just need to figure out how to get rid of the twitch.

As described above the objects are new objects redrawn at step 8 (removed at step 7), so they should not have any momentum or velocity applied to them.  Do you have any ideas?

Thanks again,

Craig

Hi Craig,

Have you seen the following tutorial? It outlines an approach for keeping objects “stable” and it might apply to your scenario.

https://coronalabs.com/blog/2015/03/03/tutorial-solutions-to-common-physics-issues/

Brent

Hi Brent,

Yes I had a look at this tutorial,  I found that a weld joint to a static body worked better that a touch joint (still a very slight bit of movement), the touch joint had some slightly visually weird effects. I will do more playing around once my game has more elements…

I started another forum post that was more specific to the movement of the object here

https://forums.coronalabs.com/topic/61076-slight-movement-of-dynamic-physics-bodies-after-physicsstart/

Again,  thanks for your help Brent,

Craig

Hmm. Can you put in your whole console error code? 

Have you tried adding print statements to try seeing if you have some serious memory leaks or bugs?

–SonicX278

That is the whole error from sublime console, and print statements dont help as it seems to always happy at a different spot.

Cheers,

Craig

Just found the problem report hiding behind everything when I did a restart,  I have attached it as a txt file.

Thanks.

Hi all,

I have pinned it down to the fact I am using physics.stop().

I have read that this can be problematic, however it puts me in rather a difficult situation.  In my game the player can switch between design mode and play mode.  I am stopping physics (as opposed to physics.pause) because it removes the problem of the physics bodies moving slightly when I run physics.start().  Accuracy is important in this case.

Does anyway know how to prevent this error with physics.stop(), or another way of stopping the physics twitch when restarting?

Cheers,

Craig

Hi Craig,

When exactly are you calling physics.stop()? Are you calling it during a collision or something? Are you still working out physics math or are bodies still “resolving”?

As for using pause(), if you continue to, there are typically ways to ensure that objects don’t shift/move after you resume. Are you setting all object velocities to 0,0 before you pause? Are you using joints which might be exerting some new force after resume?

Brent

Hi Brent,

I have been playing around for this for some time so far…  

I am calling "physics.stop() when the reset button is pressed, I had/have things working in the following order.

  1. Removed any event listeners or timers (I know this should have been done anyway when the object gets removed.

  2. Waited 2 milliseconds

  3. Physics.stop()

4. Waited 2 milliseconds

  1. physics.start()  

  2. physics.pause() 

  3. Removed the objects (removed the layer they were all in)

  4. Redrew the objects to reset their positions

  5. Added physics to new objects

I then set a timer that would constantly simulate pressing the reset button (with a  200 ms delay) and found that

By adding step 1 and 2 I was able to make it a lot more stable, it would sometimes loop for 5 seconds, sometimes 1 minute (before steps 1 and 2 it would always bomb within 10 seconds). 

However I have changed it from stop to pause and it has been looping for the last 25 minutes (and counting) without an issue.  I think I will go with physics.pause(), I just need to figure out how to get rid of the twitch.

As described above the objects are new objects redrawn at step 8 (removed at step 7), so they should not have any momentum or velocity applied to them.  Do you have any ideas?

Thanks again,

Craig

Hi Craig,

Have you seen the following tutorial? It outlines an approach for keeping objects “stable” and it might apply to your scenario.

https://coronalabs.com/blog/2015/03/03/tutorial-solutions-to-common-physics-issues/

Brent

Hi Brent,

Yes I had a look at this tutorial,  I found that a weld joint to a static body worked better that a touch joint (still a very slight bit of movement), the touch joint had some slightly visually weird effects. I will do more playing around once my game has more elements…

I started another forum post that was more specific to the movement of the object here

https://forums.coronalabs.com/topic/61076-slight-movement-of-dynamic-physics-bodies-after-physicsstart/

Again,  thanks for your help Brent,

Craig