Bus error - Simulator crashes every time

Subject: Bus error - Simulator crashes every time
Corona Version: 0.3
System Version: 10.5.7
HW Info (your computer specs): OS X 10.5.7, 15 inch macbook pro, 2.4 GHz Intel Core 2 Duo, 4 gig 667 MHz
$ uname -a
Darwin nicholas-wrights-imac-2.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386

Severity: 1 Showstopper(crash)

Reproducibility: Every Time

Description: Bus error when using simulator

Steps to reproduce (keep this as simple as possible):

  1. start simulator or debugger

=======================

I’ve written probably 5 apps with corona so far (only one submitted so far, hasn’t been approved yet), and have never had this problem prior to about 3 days ago.

Basically even starting the debugger or simulator throws a reference error like so:

$ ./debugger ANSCA Remote Debugger Run the program you wish to debug Sun Nov 1 17:59:47 nicholas-wrights-imac-2.local Corona Simulator[52576] <warning>: CGSResolveShmemReference : reference offset (36720) exceeds bounds (32768) on shmem obj 0x196150<br>2009-11-01 17:59:47.275 Corona Simulator[52576:10b] Error (1000) creating CGSWindow<br>^C^C./debugger: line 6: 52577 Bus error "$path/Corona Simulator.app/Contents/Resources/Corona Simulator_agent.app/Contents/MacOS/Corona Simulator" --run $path/debugger.lu<br>
Note that I hadn’t even chosen an application to start yet. Here’s another one where I made it as far as choosing an app:
<br>$ ./debugger <br>ANSCA Remote Debugger<br>Run the program you wish to debug<br>Copyright (C) 2009 ANSCA, Inc.<br> Version: 0.5<br> Build: 2009.10.15.1<br>Sun Nov 1 18:05:38 nicholas-wrights-imac-2.local Corona Simulator[52588] <warning>: CGSResolveShmemReference : reference offset (36848) exceeds bounds (32768) on shmem obj 0x196150<br>2009-11-01 18:05:38.470 Corona Simulator[52588:10b] Error (1000) creating CGSWindow<br>^C<br><br>^C^C^C^C./debugger: line 6: 52589 Bus error "$path/Corona Simulator.app/Contents/Resources/Corona Simulator_agent.app/Contents/MacOS/Corona Simulator" --run $path/debugger.lu<br>

I simply ran the debugger and watched it blow up. I’ve tried reinstalling the sdk but I get the same issue. Sometimes it’ll let me get as far as running a portion of the app before it locks up and I have to kill the process before it uses all of my resources.

What is weird is that this problem is very recent, but now happens every time I even try to run my apps. Just a second ago I was able to make it as far as building an app out for a device, and I’m able to run the app fine on my iphone.

It’s also worth noting that the output from starting the debugger above may not be what you guys are used to seeing. I’ve never seen the debugger work the way it’s intended (ie, as a debugger). It has always started up the same way as the simulator and I’ve never been dropped into a prompt, nor have I been able to actually use the debugger to debug my programs.

Thanks! I love the sdk so far.
[import]uid: 70 topic_id: 204 reply_id: 300204[/import]

Here are a few from running just the simulator:

$ ./simulator Sun Nov 1 18:46:48 nicholas-wrights-imac-2.local Corona Simulator[53810] <warning>: CGSResolveShmemReference : reference offset (36720) exceeds bounds (32768) on shmem obj 0x196150<br>2009-11-01 18:46:48.061 Corona Simulator[53810:10b] Error (1000) creating CGSWindow<br>^C<br>
<br>$ ./simulator <br>Copyright (C) 2009 ANSCA, Inc.<br> Version: 0.5<br> Build: 2009.10.15.1<br>Sun Nov 1 18:46:58 nicholas-wrights-imac-2.local Corona Simulator[53814] <warning>: CGSResolveShmemReference : reference offset (36720) exceeds bounds (32768) on shmem obj 0x196150<br>2009-11-01 18:46:58.001 Corona Simulator[53814:10b] Error (1000) creating CGSWindow<br>^C<br>
On the second one I was able to start an app.
[import]uid: 70 topic_id: 204 reply_id: 237[/import]

What happens if you try to run the executable? Can you attach a crash report?

One thing you can try is to try creating a new user account and see if that fixes it. I haven’t encountered this problem before and neither has anyone here, so whatever is going on appears to be specific to something on your machine. Did you run Software Update recently maybe? [import]uid: 5 topic_id: 204 reply_id: 238[/import]

Thanks for the response.

I actually rebooted my machine earlier today and that seemed to fix the problem. Never did figure out what caused it to begin with. [import]uid: 70 topic_id: 204 reply_id: 250[/import]

Glad to hear it “fixed” itself :slight_smile:

carlos [import]uid: 24 topic_id: 204 reply_id: 254[/import]

I also had this bizarre error involving CGSResolveShmemReference

I was commenting out code like mad to find the source of the error.

Rebooted the Mac as Abica mentioned and it “fixed” itself… [import]uid: 11393 topic_id: 204 reply_id: 14115[/import]

hmm…

I just erased corona. I guess it’s time to give it another shot, (crashed simulator every time was the prob, macbook 1gb ram 1.5.8 [import]uid: 34829 topic_id: 204 reply_id: 20914[/import]

still getting the crash.

Not sure what’s up.

have a look here - http://developer.anscamobile.com/forum/2011/02/05/android-corona-osx- for the crash report. [import]uid: 34829 topic_id: 204 reply_id: 20923[/import]

I’ve started getting this crash too! Sometimes it works and sometimes it doesn’t.

Here’s the terminal output, which doesn’t show any coding error …

Copyright © 2009-2010 A n s c a , I n c .
Version: 2.0.0
Build: 2011.280
The file sandbox for this project is located at the following folder:
(/Users/stefan/Library/Application Support/Corona Simulator/Spelling-F88FA69B144530F8234241E222760D1A)
appFont VAGRoundedBT-Regular
lastScene startUp
main: clean startUp
clean: texture memory 827392
/Applications/Corona.2011.280/Corona Terminal: line 9: 4738 Bus error “$path/Corona Simulator.app/Contents/MacOS/Corona Simulator” $*
logout
Here’s the part of the dump report showing the thread that crashes …
Process: Corona Simulator [4738]
Path: /Applications/Corona.2011.280/Corona Simulator.app/Contents/MacOS/Corona Simulator
Identifier: com.anscamobile.Corona_Simulator
Version: ??? (1.0)
Code Type: X86 (Native)
Parent Process: bash [4736]

Date/Time: 2011-02-07 11:55:26.143 +0000
OS Version: Mac OS X 10.6.6 (10J567)
Report Version: 6

Interval Since Last Report: 340814 sec
Crashes Since Last Report: 31
Per-App Interval Since Last Report: 330734 sec
Per-App Crashes Since Last Report: 28
Anonymous UUID: A2B5DBC4-C850-4A16-93D8-140FB68087AC

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000010
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 …nscamobile.Corona_Simulator 0x0006b1b1 0x1000 + 434609
1 …nscamobile.Corona_Simulator 0x000541e9 0x1000 + 340457
2 …nscamobile.Corona_Simulator 0x000589ae 0x1000 + 358830
3 …nscamobile.Corona_Simulator 0x0005950c 0x1000 + 361740
4 …nscamobile.Corona_Simulator 0x0007902d 0x1000 + 491565
5 …nscamobile.Corona_Simulator 0x0000fbef 0x1000 + 60399
6 com.apple.AppKit 0x938a2cf8 -[NSWindow sendEvent:] + 5693
7 com.apple.AppKit 0x937bb817 -[NSApplication sendEvent:] + 6431
8 com.apple.AppKit 0x9374f2a7 -[NSApplication run] + 917
9 com.apple.AppKit 0x937472d9 NSApplicationMain + 574
10 …nscamobile.Corona_Simulator 0x000028d9 0x1000 + 6361

Thread 1: Dispatch queue: com.apple.libdispatch-manager
0 libSystem.B.dylib 0x914df982 kevent + 10
1 libSystem.B.dylib 0x914e009c _dispatch_mgr_invoke + 215
2 libSystem.B.dylib 0x914df559 _dispatch_queue_invoke + 163
3 libSystem.B.dylib 0x914df2fe _dispatch_worker_thread2 + 240
4 libSystem.B.dylib 0x914ded81 _pthread_wqthread + 390
5 libSystem.B.dylib 0x914debc6 start_wqthread + 30

Thread 2:
0 libSystem.B.dylib 0x914dea12 __workq_kernreturn + 10
1 libSystem.B.dylib 0x914defa8 _pthread_wqthread + 941
2 libSystem.B.dylib 0x914debc6 start_wqthread + 30

Thread 3:
0 libSystem.B.dylib 0x914dea12 __workq_kernreturn + 10
1 libSystem.B.dylib 0x914defa8 _pthread_wqthread + 941
2 libSystem.B.dylib 0x914debc6 start_wqthread + 30

Thread 4: com.apple.CFSocket.private
0 libSystem.B.dylib 0x914d80c6 select$DARWIN_EXTSN + 10
1 com.apple.CoreFoundation 0x94dd6c83 __CFSocketManager + 1091
2 libSystem.B.dylib 0x914e685d _pthread_start + 345
3 libSystem.B.dylib 0x914e66e2 thread_start + 34

Thread 5:
0 libSystem.B.dylib 0x914dea12 __workq_kernreturn + 10
1 libSystem.B.dylib 0x914defa8 _pthread_wqthread + 941
2 libSystem.B.dylib 0x914debc6 start_wqthread + 30

Thread 6:
0 libSystem.B.dylib 0x914b915a semaphore_timedwait_signal_trap + 10
1 libSystem.B.dylib 0x914e6ce5 _pthread_cond_wait + 1066
2 libSystem.B.dylib 0x91515ac8 pthread_cond_timedwait_relative_np + 47
3 com.apple.audio.CoreAudio 0x976443c7 CAGuard::WaitFor(unsigned long long) + 219
4 com.apple.audio.CoreAudio 0x976473f9 CAGuard::WaitUntil(unsigned long long) + 289
5 com.apple.audio.CoreAudio 0x97644cf6 HP_IOThread::WorkLoop() + 1892
6 com.apple.audio.CoreAudio 0x9764458d HP_IOThread::ThreadEntry(HP_IOThread*) + 17
7 com.apple.audio.CoreAudio 0x976444a4 CAPThread::Entry(CAPThread*) + 140
8 libSystem.B.dylib 0x914e685d _pthread_start + 345
9 libSystem.B.dylib 0x914e66e2 thread_start + 34

Thread 7:
0 libSystem.B.dylib 0x914b920e mach_wait_until + 10
1 libSystem.B.dylib 0x91540819 nanosleep + 345
2 SDL 0x001b0453 SDL_Delay + 99
3 net.playcontrol.ALmixer 0x0013fc72 Stream_Data_Thread_Callback + 4138
4 SDL 0x001a1ecd SDL_Linked_Version + 397
5 SDL 0x001b01f1 SDL_SemWait + 49
6 libSystem.B.dylib 0x914e685d _pthread_start + 345
7 libSystem.B.dylib 0x914e66e2 thread_start + 34

Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x00000000 ebx: 0x000541c6 ecx: 0x006ee980 edx: 0x006ee980
edi: 0x006ee980 esi: 0x006f1c60 ebp: 0xbffff2a8 esp: 0xbffff290
ss: 0x0000001f efl: 0x00010286 eip: 0x0006b1b1 cs: 0x00000017
ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037
cr2: 0x00000010
[import]uid: 2646 topic_id: 204 reply_id: 21152[/import]

Solved my problem! I’d lost a ‘return true’ line at the end of a collision event handler. [import]uid: 2646 topic_id: 204 reply_id: 21397[/import]

Glad to hear.

Mine may be a noob thing.

I haven’t loaded my own program was just running the simulator and crash happens (simulator doesn’t even finish loading). [import]uid: 34829 topic_id: 204 reply_id: 21724[/import]

I have the same issue. Right after I start my app, the simulator crashes and the terminal says:

/Applications/CoronaSDK/Corona Terminal: line 9: 24764 Bus error   
"$path/Corona Simulator.app/Contents/MacOS/Corona Simulator" $\*  
logout  

My error seems different from everyone else’s. It’s probably just a simple coding mistake. But still, does anyone know what this means? [import]uid: 38000 topic_id: 204 reply_id: 58628[/import]

I just noticed that this only happens on one of my director scenes, so that means it’s probably a coding error. But still, does anyone know what sort of error would cause this? [import]uid: 38000 topic_id: 204 reply_id: 59399[/import]

If it happens on scene change, I have two suggestions of what to look for;

  1. Does the scene change on a collision event?

  2. When the second scene loads, what happens immediately with physics? Are you adding bodies? Removing bodies? Etc.

Peach :slight_smile: [import]uid: 52491 topic_id: 204 reply_id: 59465[/import]

Last night I was able to narrow it down to the physics (i.e. when I comment out the physics lines, it works fine) but today I open it up and uncommented the physics lines and it works just fine. I don’t know exactly what caused it, but it seems to be fixed.
But will there be issues when changing scenes on a collision? I was planning on using a popup when two things collided. Is there a workaround for this?
Thanks for your help! [import]uid: 38000 topic_id: 204 reply_id: 59592[/import]

Peach,
After a little bit of work, I got it working, but just now I started getting the bus error again. Let me explain:
My game is a scrolling game in which objects are moved by transition.to from one side of the screen to the other. However, when any of these objects collide with the stationary player, I get the following error numerous times:
ERROR: Cannot translate an object before collision is resolved.
just before the simulator crashes with the bus error. I assume this is the issue with the physics engine that crashes when you try to remove an object, but how can I cancel the transition.to to keep this from happening? FYI, I also try to remove the object after the collision but I use a timer to do it 100 ms after the collision. Could that be part of my issue? [import]uid: 38000 topic_id: 204 reply_id: 59637[/import]

You want to remove it AFTER the collision is resolved, yes. So make sure you are using event.phase == “ended”, for one thing.

The other thing is your transitions - is there a reason you’re using them rather than setting linear velocity? If so, that’s fine, it would just be a lot simpler (I think, I don’t know exactly how your scroller is set up) than transitions.

Peach :slight_smile: [import]uid: 52491 topic_id: 204 reply_id: 59692[/import]

I am checking to be sure that the phase is ended, but I still get the error.
Regarding the linear velocity, I really didn’t think about that when I wrote the code. I wrote the movement code a while before I implemented physics, so I didn’t consider it. I will take a look at it and think about using that. However, I currently set the objects as sensors, so that they would not bounce against each each other or the player. Can you apply liner force to a sensor, or do I need to change it to something else?
Thank you for your help and thoughts on this. [import]uid: 38000 topic_id: 204 reply_id: 59789[/import]

Hey Peter,

No, you could set the linear velocity easily on sensors as well. I wrote a really quick demo for you so you can see how it works. Try this in a new project and note how both circles are sensors and with linear velocity applied they still move freely through each other;

[lua]require ( “physics” )
physics.start()
physics.setGravity( 0, 0 )

local circle1 = display.newCircle( 160, 300, 30 )
physics.addBody(circle1, “dynamic”, {friction = 0.1, bounce = 0.2, density=0.1, isSensor=true})

circle1:setLinearVelocity(0,-50)

local circle2 = display.newCircle( 160, 400, 30 )
physics.addBody(circle2, “dynamic”, {friction = 0.1, bounce = 0.2, density=0.1, isSensor=true})

circle2:setLinearVelocity(0,-100)[/lua]

Peach

PS - Forgive somewhat messy code, a little rushed tonight. [import]uid: 52491 topic_id: 204 reply_id: 59848[/import]

Thanks for the example! That is definitely the best way to do it. However, now, instead of the previous error, I get and error saying

/Applications/CoronaSDK/Corona Terminal: line 9: 7938 Segmentation fault "$path/Corona Simulator.app/Contents/MacOS/Corona Simulator" $\*  

or the bus error (it can change every time seemingly randomly), right before the simulator crashes. This only happens when I call a scene change within the collision event, but it still happens if I put on a timer of 1sec or more.
What is going on here?

[import]uid: 38000 topic_id: 204 reply_id: 59932[/import]