Bus Error

Heya,

Actually I just solved this, but I figured I’d put the solution up anyhow. Basically I add some code which created a new collision sensor using the standard approach:

physics.addBody(img,{isSensor=true, radius=10})  

There was a lot of code around that involving timers, removing the sensor again, so it took me a while to track down. Every time I ran the simulation, when the above code executed I got:

/Applications/CoronaSDK/Corona Terminal: line 9: 1188 Bus error ...  

In fact the actual number kept changing, but never mind.

Eventually I figured out what was going on, the code was getting called during a collision event. Never ever try to modify the physics engine (by adding or removing objects) during a collision event. Number 1 rule.

Adding a quick timer.performWithDelay(1, dangerousCode) fixed the issue. However it would have been nice if Corona had output an error. [import]uid: 11757 topic_id: 10522 reply_id: 310522[/import]

Hey there
I have never gotten this so I feel it all started when I downloaded the latest nightly builds but on the other hand I am not an experienced game coder so it could be my lousy coding :slight_smile:

I am getting this
/Applications/CoronaSDK/Corona Terminal: line 9: 6593 Bus error “$path/Corona Simulator.app/Contents/MacOS/Corona Simulator” $*

and the numbers keep changing all the time. The most common place this happens is when the director class is about to load a new new screen.

I tried your tip on never ever add something to the psyhics engine while in collisionstate but that didn’t do the trick.

Anyone? Coronastaff? [import]uid: 22737 topic_id: 10522 reply_id: 41381[/import]

I get this kind of error a lot when I call physics.stop(), but not all the time, which made it difficult to track down. Do you have a physics.stop() somewhere in the new scene called by director? [import]uid: 9422 topic_id: 10522 reply_id: 41385[/import]

Not in the one that loads but in the one that unloads [import]uid: 22737 topic_id: 10522 reply_id: 41386[/import]

Try a test and comment out the line, or changing it to physics.pause() just to see if you continue to get the error or not.

If your crash is indeed due to the physic.stop() bug, it was reported at least 9 months ago so I don’t know if Ansca intends to ever fix it, but hopefully you can at least find a work around. [import]uid: 9422 topic_id: 10522 reply_id: 41392[/import]

I just got the Bus error the very first time. In my case, it is unrelated to physic.stop(). I’m not entirely sure if performWithDelay would solve my Bus error, but I think personalnadir’s rule/observation noted above is right on the money. Thank you for posting this!
[import]uid: 67217 topic_id: 10522 reply_id: 56580[/import]