I have a MacRuby app that's working great on my local box, but when I put it on another box it crashes hard. Here's the relevant thread crash info: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000ffffffff Crashed Thread: 0 Dispatch queue: com.apple.main-thread Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libmacruby.1.9.2.dylib 0x000000010010c4b1 rb_vm_resolve_const_value + 1537 1 libmacruby.1.9.2.dylib 0x00000001000f52f6 rb_objc_load_loaded_frameworks_bridgesupport + 374 2 libmacruby.1.9.2.dylib 0x0000000100157f0a macruby_main + 362 3 com.terralien.Elephant 0x000000010000142f 0x100000000 + 5167 4 com.terralien.Elephant 0x00000001000013f4 0x100000000 + 5108 The app runs fine on my own box, and the only difference I can figure between them is that I've installed BridgeSupport preview3, but the box it's crashing on hasn't. I'm doing a macruby_deploy --bs and have verified that the BridgeSupport files are being copied into the right spot in the .app file. Any ideas what might be wrong and/or how I can debug further? -- Nathaniel Talbott <:((><
On Fri, Apr 15, 2011 at 11:58 AM, Nathaniel Talbott <nathaniel@talbott.ws> wrote:
I have a MacRuby app that's working great on my local box, but when I put it on another box it crashes hard. Here's the relevant thread crash info:
I have more data on this. If I remove the references in my app to functions/constants that are only in the latest BridgeSupport (preview2), the app *still* crashes on the box that has not had BridgeSupport preview2 installed. The trace changes slightly, but note that it's *not* related to the missing functions/constants: Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Application Specific Information: __abort() called objc[1402]: garbage collection is ON Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libSystem.B.dylib 0x00007fff85b8e5d6 __kill + 10 1 libSystem.B.dylib 0x00007fff85c2ec77 __abort + 103 2 libSystem.B.dylib 0x00007fff85c132d8 release_file_streams_for_task + 0 3 libmacruby.1.9.2.dylib 0x00000001001120ce rb_pointer_new2 + 13086 4 ??? 0x5f79617272615f73 0 + 6879637049958293363 HOWEVER, if I take the "--bs" switch off of macruby_deploy so that it doesn't embed the BridgeSupport files, the app works fine on this computer so long as the references to the preview2-only functions/constants are still removed. Further, if I add back in the references to the preview2-only functions/constants, the app still errors, but it doesn't crash and it gives good data on the error: 4/15/11 8:23:15 PM Elephant[2310] /Users/ktalbott/Desktop/Elephant.app/Contents/Resources/rb_main.rb:18:in `<main>': uninitialized constant Config::KFSEventStreamEventIdSinceNow (NameError) So it appears that there is a bug in the code that handles embedded BridgeSupport files - any ideas on tracking it down? -- Nathaniel Talbott <:((><
Thanks for the report Nathaniel. Before I forget, the latest version of BridgeSupport is preview 3, not preview 2 http://www.macruby.org/files/ (small detail but you are not the first one to mention that). Here is my understanding of the problem. The --bs flag includes in your app the bs files that found in your machine. (so if you have BSp2, these files will be included). Once you deploy your app to another machine, you probably only embedded the MacRuby framework, therefore the machine has the old BS version that ships with Snow Leopard. At this point, the new BS file is loaded in the old BS and that's when the problem occurs. In other words, the new BS files are not compatible with the old BS. That's quite a problem indeed. My guess is that Apple is planning on shipping the new BS in Lion. Updating the old BS via a system update would probably break some code relying on the old format. So I'm not really sure what the solution is. Laurent, am I right? What are the solutions? Thanks, - Matt On Fri, Apr 15, 2011 at 5:25 PM, Nathaniel Talbott <nathaniel@talbott.ws>wrote:
On Fri, Apr 15, 2011 at 11:58 AM, Nathaniel Talbott <nathaniel@talbott.ws> wrote:
I have a MacRuby app that's working great on my local box, but when I put it on another box it crashes hard. Here's the relevant thread crash info:
I have more data on this. If I remove the references in my app to functions/constants that are only in the latest BridgeSupport (preview2), the app *still* crashes on the box that has not had BridgeSupport preview2 installed. The trace changes slightly, but note that it's *not* related to the missing functions/constants:
Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information: __abort() called objc[1402]: garbage collection is ON
Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libSystem.B.dylib 0x00007fff85b8e5d6 __kill + 10 1 libSystem.B.dylib 0x00007fff85c2ec77 __abort + 103 2 libSystem.B.dylib 0x00007fff85c132d8 release_file_streams_for_task + 0 3 libmacruby.1.9.2.dylib 0x00000001001120ce rb_pointer_new2 + 13086 4 ??? 0x5f79617272615f73 0 + 6879637049958293363
HOWEVER, if I take the "--bs" switch off of macruby_deploy so that it doesn't embed the BridgeSupport files, the app works fine on this computer so long as the references to the preview2-only functions/constants are still removed.
Further, if I add back in the references to the preview2-only functions/constants, the app still errors, but it doesn't crash and it gives good data on the error:
4/15/11 8:23:15 PM Elephant[2310] /Users/ktalbott/Desktop/Elephant.app/Contents/Resources/rb_main.rb:18:in `<main>': uninitialized constant Config::KFSEventStreamEventIdSinceNow (NameError)
So it appears that there is a bug in the code that handles embedded BridgeSupport files - any ideas on tracking it down?
-- Nathaniel Talbott <:((>< _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
On Fri, Apr 15, 2011 at 9:07 PM, Matt Aimonetti <mattaimonetti@gmail.com> wrote:
Thanks for the report Nathaniel. Before I forget, the latest version of BridgeSupport is preview 3, not preview 2 http://www.macruby.org/files/ (small detail but you are not the first one to mention that).
Good clarification - I ended up trying preview3 as well, with the same results. FYI, someone should probably update this page, as I think it's where a lot of the confusion is coming from: http://bridgesupport.macosforge.org/trac/wiki/Releases I hadn't seen the http://macruby.org/files page - maybe that should be linked more prominently?
Here is my understanding of the problem. The --bs flag includes in your app the bs files that found in your machine. (so if you have BSp2, these files will be included).
Right. And if those files are embedded in the app using --bs, the app crashes in macruby_main well before my code is ever run. If they are not, the app runs fine, at least until I try to call a function or reference a constant that is only included in the preview2/preview3 BridgeSupport, and even then it doesn't crash, it simply errors.
Once you deploy your app to another machine, you probably only embedded the MacRuby framework, therefore the machine has the old BS version that ships with Snow Leopard. At this point, the new BS file is loaded in the old BS and that's when the problem occurs.
In other words, the new BS files are not compatible with the old BS. That's quite a problem indeed. My guess is that Apple is planning on shipping the new BS in Lion. Updating the old BS via a system update would probably break some code relying on the old format. So I'm not really sure what the solution is.
As I understand it, the BridgeSupport files are simply declarative - they're XML describing the underlying frameworks, but aren't code themselves. The reason one needs to update to a newer version is to pick up definitions of functions and constants that the BridgeSupport files that ship with 10.6 didn't yet declare. Thus the idea behind the --bs flag and the fact that MacRuby looks in the Resources/BridgeSupport directory before looking BridgeSupport up in the standard places: by embedding the most recent specifications of the underlying code, we can call it without having to have up-to-date BridgeSupport files at the OS level. Thus, if the BridgeSupport files from my computer (preview2+) are embedded, and MacRuby correctly loads them up if they're embedded, it should all work. The underlying code being called is exactly the same, and there should be no issue. So I think there are two possibilities: I totally don't understand BridgeSupport (completely possible!) or there's simply a bug in the MacRuby code that loads BridgeSupport files from Resources/BridgeSupport. Of course, I could be completely off in my understanding of BridgeSupport - can't wait to hear from Laurent. -- Nathaniel Talbott <:((><
Hi Nathaniel, This is likely the same problem as http://www.macruby.org/trac/ticket/1217. I'll have a look, hopefully I should be able to get a fix this week-end. Laurent On Apr 15, 2011, at 8:58 AM, Nathaniel Talbott wrote:
I have a MacRuby app that's working great on my local box, but when I put it on another box it crashes hard. Here's the relevant thread crash info:
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000ffffffff Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libmacruby.1.9.2.dylib 0x000000010010c4b1 rb_vm_resolve_const_value + 1537 1 libmacruby.1.9.2.dylib 0x00000001000f52f6 rb_objc_load_loaded_frameworks_bridgesupport + 374 2 libmacruby.1.9.2.dylib 0x0000000100157f0a macruby_main + 362 3 com.terralien.Elephant 0x000000010000142f 0x100000000 + 5167 4 com.terralien.Elephant 0x00000001000013f4 0x100000000 + 5108
The app runs fine on my own box, and the only difference I can figure between them is that I've installed BridgeSupport preview3, but the box it's crashing on hasn't. I'm doing a macruby_deploy --bs and have verified that the BridgeSupport files are being copied into the right spot in the .app file.
Any ideas what might be wrong and/or how I can debug further?
-- Nathaniel Talbott <:((>< _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
I can't seem to be able to reproduce the crash. I built a sample MacRuby project (DotView), ran macruby_deploy --bs --embed on it, verified that both MacRuby.framework and the BridgeSupport files were included, then I renamed all BridgeSupport directories on my system (to make sure MacRuby won't load them), ran the app through gdb, and verified that the BridgeSupport files were loaded from inside the app bundle (and also, that the app ran fine without crashing). Looking at your backtrace, it seems that MacRuby is crashing when loading the BridgeSupport of a framework that you embedded in your app. Do you have any framework (other than MacRuby) inside your app? If yes, did you generate a BridgeSupport file for it? Also, it would be interesting if you could reduce the problem to a sample .app that you can give me. Laurent On Apr 15, 2011, at 8:16 PM, Laurent Sansonetti wrote:
Hi Nathaniel,
This is likely the same problem as http://www.macruby.org/trac/ticket/1217. I'll have a look, hopefully I should be able to get a fix this week-end.
Laurent
On Apr 15, 2011, at 8:58 AM, Nathaniel Talbott wrote:
I have a MacRuby app that's working great on my local box, but when I put it on another box it crashes hard. Here's the relevant thread crash info:
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000ffffffff Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libmacruby.1.9.2.dylib 0x000000010010c4b1 rb_vm_resolve_const_value + 1537 1 libmacruby.1.9.2.dylib 0x00000001000f52f6 rb_objc_load_loaded_frameworks_bridgesupport + 374 2 libmacruby.1.9.2.dylib 0x0000000100157f0a macruby_main + 362 3 com.terralien.Elephant 0x000000010000142f 0x100000000 + 5167 4 com.terralien.Elephant 0x00000001000013f4 0x100000000 + 5108
The app runs fine on my own box, and the only difference I can figure between them is that I've installed BridgeSupport preview3, but the box it's crashing on hasn't. I'm doing a macruby_deploy --bs and have verified that the BridgeSupport files are being copied into the right spot in the .app file.
Any ideas what might be wrong and/or how I can debug further?
-- Nathaniel Talbott <:((>< _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
On Fri, Apr 15, 2011 at 11:32 PM, Laurent Sansonetti <lsansonetti@apple.com> wrote:
I can't seem to be able to reproduce the crash. I built a sample MacRuby project (DotView), ran macruby_deploy --bs --embed on it, verified that both MacRuby.framework and the BridgeSupport files were included, then I renamed all BridgeSupport directories on my system (to make sure MacRuby won't load them), ran the app through gdb, and verified that the BridgeSupport files were loaded from inside the app bundle (and also, that the app ran fine without crashing).
Linked is a trivial crashing program (and the project I built it with); all I had to do was create a new MacRuby project in XCode 4, tweak it (using the awesome http://redwoodapp.posterous.com/macruby-and-xcode-4-build-a-self-contained-m...) to successfully build an archive, add the --bs flag to macruby_deploy, archive, and run the result on my test computer that hasn't had preview3 installed. Crashes every time. If I remove the --bs flag, it runs fine: http://dl.dropbox.com/u/438257/BridgeSupportTest.zip I have not tried to get it to crash on my development box (though I'll probably attempt that next); perhaps the difference is running it on a box that truly has never had the new BridgeSupport installed?
Looking at your backtrace, it seems that MacRuby is crashing when loading the BridgeSupport of a framework that you embedded in your app. Do you have any framework (other than MacRuby) inside your app? If yes, did you generate a BridgeSupport file for it?
Nope, the crasher has nothing embedded beyond MacRuby. -- Nathaniel Talbott <:((><
On Sat, Apr 16, 2011 at 9:29 AM, Nathaniel Talbott <nathaniel@talbott.ws> wrote:
I have not tried to get it to crash on my development box (though I'll probably attempt that next); perhaps the difference is running it on a box that truly has never had the new BridgeSupport installed?
OK, running on this hunch, I got it to crash on my local dev box. Reproduction is trivial: simply remove or rename /System/Library/BridgeSupport/ruby-1.8/bridgesupportparser.bundle. This file, which is added by the preview3 BridgeSupport installer, seems to be at the root of the issue. Apparently it's required for some reason if the BridgeSupport files are embedded within an app. Continuing my investigations, -- Nathaniel Talbott <:((><
On Apr 16, 2011, at 6:52 AM, Nathaniel Talbott wrote:
On Sat, Apr 16, 2011 at 9:29 AM, Nathaniel Talbott <nathaniel@talbott.ws> wrote:
I have not tried to get it to crash on my development box (though I'll probably attempt that next); perhaps the difference is running it on a box that truly has never had the new BridgeSupport installed?
OK, running on this hunch, I got it to crash on my local dev box. Reproduction is trivial: simply remove or rename /System/Library/BridgeSupport/ruby-1.8/bridgesupportparser.bundle. This file, which is added by the preview3 BridgeSupport installer, seems to be at the root of the issue. Apparently it's required for some reason if the BridgeSupport files are embedded within an app.
Thanks a lot for finding this, I now know exactly what the problem is :) I will commit a fix shortly. Laurent
On Saturday, April 16, 2011, Laurent Sansonetti <lsansonetti@apple.com> wrote:
Thanks a lot for finding this, I now know exactly what the problem is :) I will commit a fix shortly.
Excellent! Can't wait to see your commit, since I've been playing with a fix and am curious if I'm even looking in the right place :-) In the meantime, is there any simple workaround for 0.10? Would love to get this app shipped in working form to my alpha testers post-haste. Thanks, Nathaniel -- Nathaniel Talbott <:((><
On Sat, Apr 16, 2011 at 2:34 PM, Nathaniel Talbott <nathaniel@spreedly.com> wrote:
Excellent! Can't wait to see your commit, since I've been playing with a fix and am curious if I'm even looking in the right place :-)
Attached is my hacky patch; my sample app works if I build with it (going to move on to getting my app out next!). Can't wait to see Laurent's solution - mine feels sub-optimal. -- Nathaniel Talbott <:((><
On Apr 16, 2011, at 2:30 PM, Nathaniel Talbott wrote:
On Sat, Apr 16, 2011 at 2:34 PM, Nathaniel Talbott <nathaniel@spreedly.com> wrote:
Excellent! Can't wait to see your commit, since I've been playing with a fix and am curious if I'm even looking in the right place :-)
Attached is my hacky patch; my sample app works if I build with it (going to move on to getting my app out next!). Can't wait to see Laurent's solution - mine feels sub-optimal.
Your patch is a good workaround for you but cannot be included, as it's not going to work as expected if the user uses macruby_deploy --bs on a system where BridgeSupport preview has not been installed. I committed a fix that should work in all cases: we now parse the BridgeSupport file version number and propagate it to MacRuby core, which will accordingly load the hacks. https://github.com/MacRuby/MacRuby/commit/eedc8a3b28adc6933087e3b2694e2a1d90... Let me know if it works for you. I just wrote that patch and haven't got the time to fully test it yet. Once BridgeSupport preview ships with a version of Mac OS X, it will be time to finally get rid of the hacks :) Laurent
On Apr 16, 2011, at 11:34 AM, Nathaniel Talbott wrote:
In the meantime, is there any simple workaround for 0.10? Would love to get this app shipped in working form to my alpha testers post-haste.
Sadly no, but either your patch or embedding the master branch of MacRuby should work. At this point we only commit bug fixes to the master branch, it's very stable and always better than the last released version, so you may want to consider embedding it. Laurent
On Sun, Apr 17, 2011 at 3:32 AM, Laurent Sansonetti <lsansonetti@apple.com> wrote:
Sadly no, but either your patch or embedding the master branch of MacRuby should work. At this point we only commit bug fixes to the master branch, it's very stable and always better than the last released version, so you may want to consider embedding it.
Doing so has definitely fixed my BridgeSupport issues - thanks! I've run in to another issue related to embedding that seems to have been introduced in master; will post on that momentarily. -- Nathaniel Talbott <:((><
On Apr 15, 2011, at 8:16 PM, Laurent Sansonetti wrote:
This is likely the same problem as http://www.macruby.org/trac/ticket/1217. I'll have a look, hopefully I should be able to get a fix this week-end.
That would be great, especially given that the work-around listed in that ticket should be enough to scare the crap out of most people. :) - Jordan
participants (5)
-
Jordan K. Hubbard
-
Laurent Sansonetti
-
Matt Aimonetti
-
Nathaniel Talbott
-
Nathaniel Talbott