BUG: How to Crash the Extension Runtime in Four Easy Steps

Apologies for the clickbaity title; I couldn’t resist. I’ve found that I can reproducibly crash the NovaExtension service by:

  1. Creating an instance of a class conforming to the Disposable interface.
  2. Registering the object with Nova in the constructor via
    nova.subscriptions.add(this)
    
  3. Unregistering the object from Nova in the dispose() call, e.g.
    nova.subscriptions.delete(this)
    
  4. Activating, then deactivating the extension (in ad hoc mode).

This results in the extension service crashing while reporting Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x60000228def0> was mutated while being enumerated.' (that thing about mutating a collection while enumerating is what sent me sleuthing in my disposal logic; full crash log can be sent on request).

Now, while I understand the underlying problem – mutating a collection while enumerating it is ill-advised; it is, however, also an easy error to make – and fully acknowledge my own ham-fistedness, I feel that in the specific case of Nova extension object disposal, some guards against that kind of error might be helpful. It may just be me, but I think the application’s whole extension runtime should not go down in flames when one extension does janky stuff.

2 Likes

Thank you for the report, Martin. We’ll get this filed and investigated.

2 Likes