Crash with custom event type hash with some quarks on 3.14.0-dev

Hello, I just noticed this crash, i’ve made some tests but it is very strange for me, so i don’t know where to look for, what could be causing it ? i have not tested in 3.13

(
Event.addEventType(\happyEvent, {
    "I am so happy to be silent sometimes, says %.\n".postf(~who)
}, (who: "Alice"))
)

Event.parentTypes.happyEvent.hash; // this crash

When i have one of theses quarks enabled, the crash occurs, else i get a valid hash:

quarks
crucial-library
Ctk
ddwCommon depend on crucial-library
plugins
WindowViewRecall
XML

with this error:

*** Welcome to SuperCollider 3.14.0-dev. *** For help press Ctrl-D.
-> Event
Interpreter has crashed or stopped forcefully. [Exit code: 11]

and sometime this error:

*** Welcome to SuperCollider 3.14.0-dev. *** For help press Ctrl-D.
-> Event
ERROR: Message 'bitXor' not understood.
Perhaps you misspelled 'iter', or meant to call 'bitXor' on another receiver?
RECEIVER:
   Float 0.000000   D2D2D2D2 00000000
ARGS:
   Integer -362855238
Interpreter has crashed or stopped forcefully. [Exit code: 11]

It’s an infinitely recursive data structure, which isn’t good. Will have to look deeper later to see how to fix it.

(
Event.addEventType(\happyEvent, {
    "I am so happy to be silent sometimes, says %.\n".postf(~who)
}, (who: "Alice"))
)

e = Event.parentTypes.happyEvent;

e === e.parent[\parentTypes][\happyEvent]
-> true  // uh oh...

This is OK:

e = Event.parentTypes.happyEvent.copy.parent_(nil);
e.hash

EDIT: There is already a bug report for it, but the fix got stalled a while ago. Event:addParentType creates reference loop · Issue #3938 · supercollider/supercollider · GitHub

hjh

1 Like

Thanks for your answer and the link to bug report !

What is puzzling is it depends on quarks. I’ve made others tests and i realize it is not linked to quarks, it is just a non-deterministic behavior. Each time I reboot the interpreter, sometime it crash with hash, sometime it print the correct hash (but can crash elsewhere)

(
Event.addEventType(\happyEvent, {
    "I am so happy to be silent sometimes, says %.\n".postf(~who)
}, (who: "Alice"))
)
Event.parentTypes.happyEvent.hash; // no crash, post -> 1059750290

Event.parentTypes.happyEvent.parentTypes; // this one crash now

Also the first time i run Event.parentTypes.happyEvent.hash i get a different hash than the second time, so I guess something is computed, that can have side effects

Event.parentTypes.happyEvent.parentTypes; // post ( 'happyEvent': ( 'who': Alice ) )
Event.parentTypes.happyEvent.hash; // post 663887494
Event.parentTypes.happyEvent.parentTypes; // now same code crash

Event.parentTypes; // never crash

For completeness: Generally, recursive data structures are fine; trees are a good example. Of course, it’s not directly related to the issue at hand, just to avoid confusion.