{"id":18835372,"url":"https://github.com/danieldickison/rm-coder-crash","last_synced_at":"2026-01-26T20:30:13.845Z","repository":{"id":15884060,"uuid":"18625209","full_name":"danieldickison/rm-coder-crash","owner":"danieldickison","description":"Demo of a RubyMotion crash.","archived":false,"fork":false,"pushed_at":"2014-04-10T05:42:47.000Z","size":148,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-30T07:44:16.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danieldickison.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-10T05:35:29.000Z","updated_at":"2014-04-10T05:42:47.000Z","dependencies_parsed_at":"2022-08-04T07:00:16.194Z","dependency_job_id":null,"html_url":"https://github.com/danieldickison/rm-coder-crash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieldickison%2Frm-coder-crash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieldickison%2Frm-coder-crash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieldickison%2Frm-coder-crash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieldickison%2Frm-coder-crash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danieldickison","download_url":"https://codeload.github.com/danieldickison/rm-coder-crash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239770036,"owners_count":19693985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T02:16:00.466Z","updated_at":"2026-01-26T20:30:13.801Z","avatar_url":"https://github.com/danieldickison.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"rm-coder-crash\n==============\n\nDemo of a RubyMotion crash.  The DiskCacheEntry object seems to occasionally get deallocated before `-[NSKeyedArchiver unarchiveObjectWithFile:]` returns when the archiving/unarchiving is happening in a serial GCD queue in Obj-C while the RM code is running in a background Dispatch::Queue.  I'm not sure if all of those conditions are necessary, but it seems to be sufficient.\n\nInterestingly, *not* calling `init` from DiskCacheEntry's `initWithCoder:` method fixes the problem (or at least makes it much less frequent).\n\n```\n$ rake debug=1 target=6.1\n     Build ./build/iPhoneSimulator-6.0-Development\n     Build objc\n      Link ./build/iPhoneSimulator-6.0-Development/coder_crash.app/coder_crash\n    Create ./build/iPhoneSimulator-6.0-Development/coder_crash.app/Info.plist\n    Create ./build/iPhoneSimulator-6.0-Development/coder_crash.dSYM\n  Simulate ./build/iPhoneSimulator-6.0-Development/coder_crash.app\n2014-04-10 01:37:54.175 coder_crash[2194:3d03] unarchived entry \u003cDiskCacheEntry format:8 data:17855 bytes\u003e\n2014-04-10 01:37:54.181 coder_crash[2194:3d03] unarchived entry \u003cDiskCacheEntry format:8 data:17855 bytes\u003e\n2014-04-10 01:37:54.268 coder_crash[2194:3c03] archived entry \u003cDiskCacheEntry format:6 data:17855 bytes\u003e\n2014-04-10 01:37:54.373 coder_crash[2194:3c03] unarchived entry \u003cDiskCacheEntry format:6 data:17855 bytes\u003e\n2014-04-10 01:37:54.503 coder_crash[2194:3c03] archived entry \u003cDiskCacheEntry format:3 data:17855 bytes\u003e\n2014-04-10 01:37:54.632 coder_crash[2194:3c03] unarchived entry \u003cDiskCacheEntry format:3 data:17855 bytes\u003e\n2014-04-10 01:37:54.765 coder_crash[2194:3c03] unarchived entry \u003cDiskCacheEntry format:3 data:17855 bytes\u003e\n2014-04-10 01:37:54.908 coder_crash[2194:3c03] unarchived entry \u003cDiskCacheEntry format:3 data:17855 bytes\u003e\n2014-04-10 01:37:54.977 coder_crash[2194:3c03] unarchived entry \u003cDiskCacheEntry format:3 data:17855 bytes\u003e\n[...]\n2014-04-10 01:38:44.087 coder_crash[2194:3c03] unarchived entry \u003cDiskCacheEntry format:1 data:17855 bytes\u003e\n2014-04-10 01:38:44.200 coder_crash[2194:3c03] unarchived entry \u003cDiskCacheEntry format:1 data:17855 bytes\u003e\n2014-04-10 01:38:44.266 coder_crash[2194:3c03] archived entry \u003cDiskCacheEntry format:4 data:17855 bytes\u003e\n2014-04-10 01:38:44.307 coder_crash[2194:3c03] archived entry \u003cDiskCacheEntry format:5 data:17855 bytes\u003e\nExecuting commands in '/var/folders/j3/6n4txds13kb70hklkw70r2040000gn/T/_simgdbcmds_ios'.\n(lldb)  process attach -p 2194\nProcess 2194 stopped\nExecutable module set to \"/usr/lib/dyld\".\nArchitecture set to: i486-apple-macosx.\n(lldb)  command script import /Library/RubyMotion/lldb/lldb.py\n(lldb)  breakpoint set --name rb_exc_raise\nBreakpoint 1: no locations (pending).\nWARNING:  Unable to resolve breakpoint to any actual locations.\n(lldb)  breakpoint set --name malloc_error_break\nBreakpoint 2: no locations (pending).\nWARNING:  Unable to resolve breakpoint to any actual locations.\n(lldb)  continue\nProcess 2194 resuming\nProcess 2194 stopped\n1 location added to breakpoint 1\n1 location added to breakpoint 2\n(lldb) bt\n* thread #1: tid = 0xfca933, 0x02a697ca libsystem_kernel.dylib`__psynch_cvwait + 10, queue = 'com.apple.main-thread'\n  * frame #0: 0x02a697ca libsystem_kernel.dylib`__psynch_cvwait + 10\n    frame #1: 0x02b5cd1d libsystem_pthread.dylib`_pthread_cond_wait + 728\n    frame #2: 0x02b5ec25 libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71\n    frame #3: 0x0014e15a coder_crash`rb_thread_wait_for + 234\n    frame #4: 0x0009740e coder_crash`rb_f_sleep + 62\n    frame #5: 0x00125237 coder_crash`rb_vm_dispatch + 4679\n    frame #6: 0x00004f6c coder_crash`vm_dispatch + 1100\n    frame #7: 0x0000d706 coder_crash`rb_scope__run_test__(self=0x077a12c0) + 934 at app_delegate.rb:22\n    frame #8: 0x0013ef3d coder_crash`dispatch_rimp_caller(objc_object* (*)(objc_object*, objc_selector*, ...), unsigned long, objc_selector, int, unsigned long const*) + 46445\n    frame #9: 0x0012593a coder_crash`rb_vm_dispatch + 6474\n    frame #10: 0x00004f6c coder_crash`vm_dispatch + 1100\n    frame #11: 0x0000cbf7 coder_crash`rb_scope__application:didFinishLaunchingWithOptions:__(self=0x077a12c0, application=0x078f35e0, launchOptions=0x00000004) + 119 at app_delegate.rb:3\n    frame #12: 0x0000cc6f coder_crash`__unnamed_20 + 95\n    frame #13: 0x0055f157 UIKit`-[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 266\n    frame #14: 0x0055f747 UIKit`-[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1248\n    frame #15: 0x0056094b UIKit`-[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 805\n    frame #16: 0x00571cb5 UIKit`-[UIApplication handleEvent:withNewEvent:] + 1022\n    frame #17: 0x00572beb UIKit`-[UIApplication sendEvent:] + 85\n    frame #18: 0x00564698 UIKit`_UIApplicationHandleEvent + 9874\n    frame #19: 0x03130df9 GraphicsServices`_PurpleEventCallback + 339\n    frame #20: 0x03130ad0 GraphicsServices`PurpleEventCallback + 46\n    frame #21: 0x0180ebf5 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53\n    frame #22: 0x0180e962 CoreFoundation`__CFRunLoopDoSource1 + 146\n    frame #23: 0x0183fbb6 CoreFoundation`__CFRunLoopRun + 2118\n    frame #24: 0x0183ef44 CoreFoundation`CFRunLoopRunSpecific + 276\n    frame #25: 0x0183ee1b CoreFoundation`CFRunLoopRunInMode + 123\n    frame #26: 0x0056017a UIKit`-[UIApplication _run] + 774\n    frame #27: 0x00561ffc UIKit`UIApplicationMain + 1211\n    frame #28: 0x000039bc coder_crash`main(argc=1, argv=0xbffff018) + 156 at main.mm:15\n(lldb) c\nProcess 2194 resuming\nProcess 2194 stopped\n* thread #6: tid = 0xfcb013, 0x0020509b libobjc.A.dylib`objc_msgSend + 15, queue = 'coding_test_archive', stop reason = EXC_BAD_ACCESS (code=1, address=0x50000008)\n    frame #0: 0x0020509b libobjc.A.dylib`objc_msgSend + 15\nlibobjc.A.dylib`objc_msgSend + 15:\n-\u003e 0x20509b:  movl   0x8(%edx), %edi\n   0x20509e:  pushl  %esi\n   0x20509f:  movl   (%edi), %esi\n   0x2050a1:  movl   %ecx, %edx\n(lldb) bt\n* thread #6: tid = 0xfcb013, 0x0020509b libobjc.A.dylib`objc_msgSend + 15, queue = 'coding_test_archive', stop reason = EXC_BAD_ACCESS (code=1, address=0x50000008)\n  * frame #0: 0x0020509b libobjc.A.dylib`objc_msgSend + 15\n    frame #1: 0x0107446b Foundation`+[NSKeyedUnarchiver unarchiveObjectWithFile:] + 280\n    frame #2: 0x0000324e coder_crash`__17-[BCArchive get:]_block_invoke(.block_descriptor=\u003cunavailable\u003e) + 190 at archive.m:23\n    frame #3: 0x0264a53f libdispatch.dylib`_dispatch_call_block_and_release + 15\n    frame #4: 0x0265c014 libdispatch.dylib`_dispatch_client_callout + 14\n    frame #5: 0x0264c418 libdispatch.dylib`_dispatch_queue_drain + 239\n    frame #6: 0x0264c2a6 libdispatch.dylib`_dispatch_queue_invoke + 59\n    frame #7: 0x0264d280 libdispatch.dylib`_dispatch_root_queue_drain + 231\n    frame #8: 0x0264d450 libdispatch.dylib`_dispatch_worker_thread2 + 39\n    frame #9: 0x02b5bdab libsystem_pthread.dylib`_pthread_wqthread + 336\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanieldickison%2Frm-coder-crash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanieldickison%2Frm-coder-crash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanieldickison%2Frm-coder-crash/lists"}