On Thu, Oct 30, 2008 at 10:16 PM, Colin Barrett <[EMAIL PROTECTED]> wrote: > On Thu, Oct 30, 2008 at 5:30 PM, Michael Ash <[EMAIL PROTECTED]> wrote: >> Based on the state of the program when it crashes, it appears that the >> problem is caused by a race condition which occasionally causes two of >> the worker threads that NSOperationQueue spawns to dequeue and execute >> the same NSOperation. Since an NSOperation is only supposed to run >> once, things fall down go boom. This is just a theory, mind, and I'm >> not sure of it yet. > > I'm not sure it would help, but it might. You could try using the > dependency mechanism in addition to setting maxConcurrentOperations to > 1. Keep track of the last NSOperation in your for loop and assign in > as you go. > > If that fixes it, it could be a race in maxConcurrentOperations. > > This is all highly speculative.
Thanks for the suggestion. I tried it out and it still crashes with that same exception. I even tried it without setting the maxConcurrentOperations and it still crashed. When I tried it in the case where the operations get enqueued in a separate thread instead of from the operation method, then it still crashed but took a long time (5-10 minutes, didn't count exactly) to do so. So it would seem that this helps somehow but not quite enough. This last case is particularly scary to me. I'm not doing anything that NSOperationQueue isn't explicitly set up for. I'm just posting NSOperations to queues that have been created and are sitting in memory. I'm not fiddling with the maxConcurrentOperations, I'm not doing anything weird like enqueueing a new operation from the middle of an existing one, I'm just spawning some threads which post operations to queues and let them run. And it *still* crashes. I hate to make this sort of sweeping pronouncement because it seems like a great way to end up looking like a fool, but at this point I can only conclude that NSOperationQueue is fundamentally broken and should not be used until this problem is fixed. Of course I would love to be wrong. Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]