#164: MacRuby crashes Cocoa app with exception in CFEqual
--------------------------------+-------------------------------------------
 Reporter:  [EMAIL PROTECTED]  |        Owner:  [EMAIL PROTECTED]
     Type:  defect              |       Status:  new                  
 Priority:  blocker             |    Milestone:  MacRuby 0.4          
Component:  MacRuby             |   Resolution:                       
 Keywords:  crash,cfequal       |  
--------------------------------+-------------------------------------------

Old description:

> Cocoa application built using MacRuby r746 on OS 10.5.5 with a Core 2 Duo
> MBP with 4GB of RAM.
>
> I am invoking a ruby proc using performRubySelector as follows:
>
> callSelector = @selector(call:);
> proc = [[MacRuby sharedRuntime] evaluateString:[NSString
> stringWithFormat:@"proc %@", source]];
> return [proc performRubySelector:callSelector
> withArguments:_arg1_,_arg2_,nil];
>
> in this case I am passing two Objective-C objects, part of my application
> data model, into the proc. The source of the proc is:
>
> do |generateTool,player|
>   if rand < 0.5
>     generateTool.directionKnob.value = 1
>   else
>     generateTool.directionKnob.value = 5
>   end
> end
>
> At some point the application crashes with the following stack trace:
>
> (gdb) thread apply all bt
>
> Thread 6 (process 59831 thread 0x6f17):
> #0  0x9063c68e in __semwait_signal ()
> #1  0x90667986 in _pthread_cond_wait ()
> #2  0x9066736d in pthread_cond_wait$UNIX2003 ()
> #3  0x900db692 in -[NSCondition wait] ()
> #4  0x9009402a in -[NSObject(NSThreadPerformAdditions)
> performSelector:onThread:withObject:waitUntilDone:modes:] ()
> #5  0x900e7648 in -[NSObject(NSThreadPerformAdditions)
> performSelectorOnMainThread:withObject:waitUntilDone:] ()
> #6  0x0001cf7e in -[ELTool run:] (self=0x22afa80, _cmd=0x96884ee0,
> _playhead_=0x0) at
> /Users/matt/Projects/LucidMac/Elysium/src/tools/ELTool.m:83
> #7  0x000087bc in -[ELLayer pulse] (self=0x2246630, _cmd=0x2b27f) at
> /Users/matt/Projects/LucidMac/Elysium/src/datamodel/ELLayer.m:245
> #8  0x00007f9f in -[ELLayer run] (self=0x2246630, _cmd=0x96884a24) at
> /Users/matt/Projects/LucidMac/Elysium/src/datamodel/ELLayer.m:155
> #9  0x000081ca in -[ELLayer runLayer] (self=0x2246630, _cmd=0x2b203) at
> /Users/matt/Projects/LucidMac/Elysium/src/datamodel/ELLayer.m:177
> #10 0x90093bad in -[NSThread main] ()
> #11 0x90093754 in __NSThread__main__ ()
> #12 0x906666f5 in _pthread_start ()
> #13 0x906665b2 in thread_start ()
>
> Thread 5 (process 59831 thread 0x5403):
> #0  0x9063c68e in __semwait_signal ()
> #1  0x9063c50f in nanosleep$UNIX2003 ()
> #2  0x002ec71e in thread_timer (dummy=0x0) at thread_pthread.c:571
> #3  0x906666f5 in _pthread_start ()
> #4  0x906665b2 in thread_start ()
>
> Thread 4 (process 59831 thread 0x4d03):
> #0  0x906354a6 in mach_msg_trap ()
> #1  0x9063cc9c in mach_msg ()
> #2  0x00098f0f in XServerMachPort::ReceiveMessage ()
> #3  0x0008b477 in MIDIInPortThread::Run ()
> #4  0x0008f07d in XThread::RunHelper ()
> #5  0x000999ee in CAPThread::Entry ()
> #6  0x906666f5 in _pthread_start ()
> #7  0x906665b2 in thread_start ()
>
> Thread 3 (process 59831 thread 0x3d03):
> #0  0x906354a6 in mach_msg_trap ()
> #1  0x9063cc9c in mach_msg ()
> #2  0x011a7c39 in __ape_agent ()
> #3  0x906666f5 in _pthread_start ()
> #4  0x906665b2 in thread_start ()
>
> Thread 2 (process 59831 thread 0x2a03):
> #0  0x9063c68e in __semwait_signal ()
> #1  0x90667986 in _pthread_cond_wait ()
> #2  0x9066736d in pthread_cond_wait$UNIX2003 ()
> #3  0x93f36bcf in auto_collection_thread ()
> #4  0x906666f5 in _pthread_start ()
> #5  0x906665b2 in thread_start ()
>
> Thread 1 (process 59831 thread 0x10b):
> #0  0x92fce036 in CFEqual ()
> #1  0x900b917f in -[NSKeyValueUnnestedProperty
> _keyPathIfAffectedByValueForKey:exactMatch:] ()
> #2  0x900b9015 in -[NSKeyValueUnnestedProperty
> keyPathIfAffectedByValueForKey:exactMatch:] ()
> #3  0x9008fe81 in -[NSObject(NSKeyValueObserverNotification)
> willChangeValueForKey:] ()
> #4  0x9016c96d in _NSSetIntValueAndNotify ()
> #5  0x903dc1dd in .LCFI1 ()
> #6  0x903dc771 in ffi_call ()
> #7  0x002fd3e0 in rb_objc_call2 (recv=36326752, klass=501521904,
> sel=0x1283530, imp=0x9016c8f0 <_NSSetIntValueAndNotify>, sig=0x202e630,
> bs_method=0x0, argc=1, argv=0x14e0058) at objc.m:1296
> #8  0x002e64d3 in vm_call_method (th=0x203b6b0, cfp=0x155ff50, num=1,
> blockptr=0x0, flag=97, id=<value temporarily unavailable, due to
> optimizations>, recv=36326752, klass=501521904, mcache=0x202e620) at
> vm_insnhelper.c:662
> #9  0x002d6759 in vm_eval (th=0x203b6b0, initial=<value temporarily
> unavailable, due to optimizations>) at insns.def:1067
> #10 0x002e0f6b in vm_eval_body (th=0x203b6b0) at vm.c:1033
> #11 0x002e14db in vm_invoke_proc (th=0x203b6b0, proc=0x22a3530,
> self=33777776, argc=1, argv=0xbfffe5b0, blockptr=0x0) at vm.c:449
> #12 0x0020ab6f in proc_call (argc=1, argv=0x1, procval=1) at proc.c:506
> #13 0x002cf035 in call_cfunc (func=0x20ab10 <proc_call>, recv=36301072,
> len=<value temporarily unavailable, due to optimizations>, argc=1,
> argv=0xbfffe5b0) at vm_insnhelper.c:289
> #14 0x002e2539 in vm_call0 (th=0x203b6b0, klass=19322032, recv=36301072,
> id=128335, oid=4, argc=1, argv=0xbfffe5b0, body=0x2069c40, nosuper=0) at
> vm_eval.c:75
> #15 0x002f4db8 in performRuby_safe (arg=1) at objc.m:3545
> #16 0x002052a9 in rb_rescue2 (b_proc=0x2f4d60 <performRuby_safe>,
> data1=3221218812, r_proc=0x2f4dc0 <performRuby_rescue>, data2=0) at
> eval.c:662
> #17 0x002f8f47 in -[NSObject(MacRubyAdditions)
> performRubySelector:withArguments:count:] (self=0x229e910, _cmd=0x30fd70,
> sel=0x2f1a0, argv=0xbfffe660, argc=1) at objc.m:3609
> #18 0x002f4ea0 in -[NSObject(MacRubyAdditions)
> performRubySelector:withArguments:] (self=0x1, _cmd=0x30fd4c, sel=0x1,
> firstArg=0x22afa80) at objc.m:3649
> #19 0x0001e42a in -[RubyBlock evalWithArg:arg:] (self=0x23b5ec0,
> _cmd=0x2ef72, _arg1_=0x22afa80, _arg2_=0x0) at
> /Users/matt/Projects/LucidMac/Elysium/src/scripting/RubyBlock.m:55
> #20 0x0001d0bf in -[ELTool runWillRunScript:] (self=0x22afa80,
> _cmd=0x2effc, _playhead_=0x0) at
> /Users/matt/Projects/LucidMac/Elysium/src/tools/ELTool.m:104
> #21 0x9009475c in __NSThreadPerformPerform ()
> #22 0x92fcb615 in CFRunLoopRunSpecific ()
> #23 0x92fcbcf8 in CFRunLoopRunInMode ()
> #24 0x946a1480 in RunCurrentEventLoopInMode ()
> #25 0x946a1299 in ReceiveNextEventCommon ()
> #26 0x946a110d in BlockUntilNextEventMatchingListInMode ()
> #27 0x927073ed in _DPSNextEvent ()
> #28 0x92706ca0 in -[NSApplication
> nextEventMatchingMask:untilDate:inMode:dequeue:] ()
> #29 0x926ffcdb in -[NSApplication run] ()
> #30 0x926ccf14 in NSApplicationMain ()
> #31 0x00002670 in main (argc=3, argv=0xbffff6ac) at
> /Users/matt/Projects/LucidMac/Elysium/main.m:13
> (gdb)
>
> then crashed with an EXC_BAD_ACCESS signal.
>
> This problem is blocking the next release of my app which utilizes a lot
> of Ruby scripting.

New description:

 Cocoa application built using MacRuby r746 on OS 10.5.5 with a Core 2 Duo
 MBP with 4GB of RAM.

 I am invoking a ruby proc using performRubySelector as follows:

 {{{
 #!ruby
 callSelector = @selector(call:);
 proc = [[MacRuby sharedRuntime] evaluateString:[NSString
 stringWithFormat:@"proc %@", source]];
 return [proc performRubySelector:callSelector
 withArguments:_arg1_,_arg2_,nil];
 }}}

 in this case I am passing two Objective-C objects, part of my application
 data model, into the proc. The source of the proc is:

 {{{
 #!ruby
 do |generateTool,player|
   if rand < 0.5
     generateTool.directionKnob.value = 1
   else
     generateTool.directionKnob.value = 5
   end
 end
 }}}

 At some point the application crashes with the following stack trace:

 {{{
 (gdb) thread apply all bt

 Thread 6 (process 59831 thread 0x6f17):
 #0  0x9063c68e in __semwait_signal ()
 #1  0x90667986 in _pthread_cond_wait ()
 #2  0x9066736d in pthread_cond_wait$UNIX2003 ()
 #3  0x900db692 in -[NSCondition wait] ()
 #4  0x9009402a in -[NSObject(NSThreadPerformAdditions)
 performSelector:onThread:withObject:waitUntilDone:modes:] ()
 #5  0x900e7648 in -[NSObject(NSThreadPerformAdditions)
 performSelectorOnMainThread:withObject:waitUntilDone:] ()
 #6  0x0001cf7e in -[ELTool run:] (self=0x22afa80, _cmd=0x96884ee0,
 _playhead_=0x0) at
 /Users/matt/Projects/LucidMac/Elysium/src/tools/ELTool.m:83
 #7  0x000087bc in -[ELLayer pulse] (self=0x2246630, _cmd=0x2b27f) at
 /Users/matt/Projects/LucidMac/Elysium/src/datamodel/ELLayer.m:245
 #8  0x00007f9f in -[ELLayer run] (self=0x2246630, _cmd=0x96884a24) at
 /Users/matt/Projects/LucidMac/Elysium/src/datamodel/ELLayer.m:155
 #9  0x000081ca in -[ELLayer runLayer] (self=0x2246630, _cmd=0x2b203) at
 /Users/matt/Projects/LucidMac/Elysium/src/datamodel/ELLayer.m:177
 #10 0x90093bad in -[NSThread main] ()
 #11 0x90093754 in __NSThread__main__ ()
 #12 0x906666f5 in _pthread_start ()
 #13 0x906665b2 in thread_start ()

 Thread 5 (process 59831 thread 0x5403):
 #0  0x9063c68e in __semwait_signal ()
 #1  0x9063c50f in nanosleep$UNIX2003 ()
 #2  0x002ec71e in thread_timer (dummy=0x0) at thread_pthread.c:571
 #3  0x906666f5 in _pthread_start ()
 #4  0x906665b2 in thread_start ()

 Thread 4 (process 59831 thread 0x4d03):
 #0  0x906354a6 in mach_msg_trap ()
 #1  0x9063cc9c in mach_msg ()
 #2  0x00098f0f in XServerMachPort::ReceiveMessage ()
 #3  0x0008b477 in MIDIInPortThread::Run ()
 #4  0x0008f07d in XThread::RunHelper ()
 #5  0x000999ee in CAPThread::Entry ()
 #6  0x906666f5 in _pthread_start ()
 #7  0x906665b2 in thread_start ()

 Thread 3 (process 59831 thread 0x3d03):
 #0  0x906354a6 in mach_msg_trap ()
 #1  0x9063cc9c in mach_msg ()
 #2  0x011a7c39 in __ape_agent ()
 #3  0x906666f5 in _pthread_start ()
 #4  0x906665b2 in thread_start ()

 Thread 2 (process 59831 thread 0x2a03):
 #0  0x9063c68e in __semwait_signal ()
 #1  0x90667986 in _pthread_cond_wait ()
 #2  0x9066736d in pthread_cond_wait$UNIX2003 ()
 #3  0x93f36bcf in auto_collection_thread ()
 #4  0x906666f5 in _pthread_start ()
 #5  0x906665b2 in thread_start ()

 Thread 1 (process 59831 thread 0x10b):
 #0  0x92fce036 in CFEqual ()
 #1  0x900b917f in -[NSKeyValueUnnestedProperty
 _keyPathIfAffectedByValueForKey:exactMatch:] ()
 #2  0x900b9015 in -[NSKeyValueUnnestedProperty
 keyPathIfAffectedByValueForKey:exactMatch:] ()
 #3  0x9008fe81 in -[NSObject(NSKeyValueObserverNotification)
 willChangeValueForKey:] ()
 #4  0x9016c96d in _NSSetIntValueAndNotify ()
 #5  0x903dc1dd in .LCFI1 ()
 #6  0x903dc771 in ffi_call ()
 #7  0x002fd3e0 in rb_objc_call2 (recv=36326752, klass=501521904,
 sel=0x1283530, imp=0x9016c8f0 <_NSSetIntValueAndNotify>, sig=0x202e630,
 bs_method=0x0, argc=1, argv=0x14e0058) at objc.m:1296
 #8  0x002e64d3 in vm_call_method (th=0x203b6b0, cfp=0x155ff50, num=1,
 blockptr=0x0, flag=97, id=<value temporarily unavailable, due to
 optimizations>, recv=36326752, klass=501521904, mcache=0x202e620) at
 vm_insnhelper.c:662
 #9  0x002d6759 in vm_eval (th=0x203b6b0, initial=<value temporarily
 unavailable, due to optimizations>) at insns.def:1067
 #10 0x002e0f6b in vm_eval_body (th=0x203b6b0) at vm.c:1033
 #11 0x002e14db in vm_invoke_proc (th=0x203b6b0, proc=0x22a3530,
 self=33777776, argc=1, argv=0xbfffe5b0, blockptr=0x0) at vm.c:449
 #12 0x0020ab6f in proc_call (argc=1, argv=0x1, procval=1) at proc.c:506
 #13 0x002cf035 in call_cfunc (func=0x20ab10 <proc_call>, recv=36301072,
 len=<value temporarily unavailable, due to optimizations>, argc=1,
 argv=0xbfffe5b0) at vm_insnhelper.c:289
 #14 0x002e2539 in vm_call0 (th=0x203b6b0, klass=19322032, recv=36301072,
 id=128335, oid=4, argc=1, argv=0xbfffe5b0, body=0x2069c40, nosuper=0) at
 vm_eval.c:75
 #15 0x002f4db8 in performRuby_safe (arg=1) at objc.m:3545
 #16 0x002052a9 in rb_rescue2 (b_proc=0x2f4d60 <performRuby_safe>,
 data1=3221218812, r_proc=0x2f4dc0 <performRuby_rescue>, data2=0) at
 eval.c:662
 #17 0x002f8f47 in -[NSObject(MacRubyAdditions)
 performRubySelector:withArguments:count:] (self=0x229e910, _cmd=0x30fd70,
 sel=0x2f1a0, argv=0xbfffe660, argc=1) at objc.m:3609
 #18 0x002f4ea0 in -[NSObject(MacRubyAdditions)
 performRubySelector:withArguments:] (self=0x1, _cmd=0x30fd4c, sel=0x1,
 firstArg=0x22afa80) at objc.m:3649
 #19 0x0001e42a in -[RubyBlock evalWithArg:arg:] (self=0x23b5ec0,
 _cmd=0x2ef72, _arg1_=0x22afa80, _arg2_=0x0) at
 /Users/matt/Projects/LucidMac/Elysium/src/scripting/RubyBlock.m:55
 #20 0x0001d0bf in -[ELTool runWillRunScript:] (self=0x22afa80,
 _cmd=0x2effc, _playhead_=0x0) at
 /Users/matt/Projects/LucidMac/Elysium/src/tools/ELTool.m:104
 #21 0x9009475c in __NSThreadPerformPerform ()
 #22 0x92fcb615 in CFRunLoopRunSpecific ()
 #23 0x92fcbcf8 in CFRunLoopRunInMode ()
 #24 0x946a1480 in RunCurrentEventLoopInMode ()
 #25 0x946a1299 in ReceiveNextEventCommon ()
 #26 0x946a110d in BlockUntilNextEventMatchingListInMode ()
 #27 0x927073ed in _DPSNextEvent ()
 #28 0x92706ca0 in -[NSApplication
 nextEventMatchingMask:untilDate:inMode:dequeue:] ()
 #29 0x926ffcdb in -[NSApplication run] ()
 #30 0x926ccf14 in NSApplicationMain ()
 #31 0x00002670 in main (argc=3, argv=0xbffff6ac) at
 /Users/matt/Projects/LucidMac/Elysium/main.m:13
 (gdb)
 }}}

 then crashed with an EXC_BAD_ACCESS signal.

 This problem is blocking the next release of my app which utilizes a lot
 of Ruby scripting.

--

Comment(by [EMAIL PROTECTED]):

 You should use [https://www.macruby.org/trac/wiki/WikiFormatting wiki
 formatting] to preserve pre-formatted whitespace. I've cleaned up the
 description for you.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/164#comment:2>
MacRuby <http://macruby.org/>

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to