[MacRuby] #1372: Exceptions thrown inside dispatch queue blocks propagate as uncaught objective-c exceptions
#1372: Exceptions thrown inside dispatch queue blocks propagate as uncaught objective-c exceptions ------------------------------------+--------------------------------------- Reporter: mrada@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: reduction ------------------------------------+--------------------------------------- Specifically, I had this problem because a test assertion inside of a block failed. Reduction: {{{ a = Dispatch::Queue.new 'org.macruby.test' a.sync { raise Exception, 'oh noses' } }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1372> MacRuby <http://macruby.org/>
#1372: Exceptions thrown inside dispatch queue blocks propagate as uncaught objective-c exceptions ------------------------------------+--------------------------------------- Reporter: mrada@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: reduction ------------------------------------+--------------------------------------- Comment(by eloy.de.enige@…): From http://developer.apple.com/library/mac/#documentation/Performance/Reference/...: {{{ GCD is a C level API; it does not catch exceptions generated by higher level languages. Your application must catch all exceptions before returning from a block submitted to a dispatch queue. }}} So I guess MacRuby does the same, might be a performance issue. -- Ticket URL: <http://www.macruby.org/trac/ticket/1372#comment:1> MacRuby <http://macruby.org/>
#1372: Exceptions thrown inside dispatch queue blocks propagate as uncaught objective-c exceptions ------------------------------------+--------------------------------------- Reporter: mrada@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: reduction ------------------------------------+--------------------------------------- Comment(by mrada@…): The following case is handled (properly?): {{{ a = Dispatch::Queue.new 'org.macruby.test' a.sync { 1 + 'e' } }}} So you think it is just slow to handle in the general case? Seems weird since it might be possible for unexpected exceptions to crash MacRuby and the workaround is to catch the exception inside the block and then re-raise outside the block so the proper handler can deal with the exception. This would be the case with mintiest. -- Ticket URL: <http://www.macruby.org/trac/ticket/1372#comment:2> MacRuby <http://macruby.org/>
#1372: Exceptions thrown inside dispatch queue blocks propagate as uncaught objective-c exceptions ------------------------------------+--------------------------------------- Reporter: mrada@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: reduction ------------------------------------+--------------------------------------- Comment(by mrada@…): Actually, looks like variables are copied in, but not copied out afterwards: {{{ a = Dispatch::Queue.new 'org.macruby.test' exception = nil a.sync { begin raise Exception, 'oh noses' rescue Exception => e exception = e end } puts exception.inspect }}} So I'm not sure how to work around this issue. -- Ticket URL: <http://www.macruby.org/trac/ticket/1372#comment:3> MacRuby <http://macruby.org/>
#1372: Exceptions thrown inside dispatch queue blocks propagate as uncaught objective-c exceptions ------------------------------------+--------------------------------------- Reporter: mrada@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: reduction ------------------------------------+--------------------------------------- Comment(by eloy.de.enige@…): Yes, local variables are copied. Instance variables, however, are not. Yup, lot's of rules :) -- Ticket URL: <http://www.macruby.org/trac/ticket/1372#comment:4> MacRuby <http://macruby.org/>
#1372: Exceptions thrown inside dispatch queue blocks propagate as uncaught objective-c exceptions ------------------------------------+--------------------------------------- Reporter: mrada@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: reduction ------------------------------------+--------------------------------------- Comment(by mrada@…): Ok, cool, at least there is a workaround. I can see why the rules exist, but they still make me say OMGCD. -- Ticket URL: <http://www.macruby.org/trac/ticket/1372#comment:5> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby