Bug - repeatable lockup when doing something silly with loopback port

Tags: #<Tag:0x00007f9796842a08>

Hi @brad

A bit obscure. This is repeatable with any input device and VST:

  1. Connect an input port to the same loopback port (e.g. my “Top Keys” to “Loopback - Top Keys”)
  2. Play some notes on controller.
  3. Connect input device to a VST. Immediate lock-up with spinning cursor.

Build 3653.


But why on earth would you want to do that? You’re creating an infinite loop that will go mad as designed. :confused:

I would be insane if I did that on purpose :slight_smile:

The impact was that I lost edits to a song I was working on. I guess it would be nice to fix if not too much trouble.


Hmmm, not sure if you can expect a “fix” - essentially, Cantabile is working as designed. Loopback ports are an advanced feature - it is for good reasons that they need to be explicitly enabled, so I guess @brad expects people to know what they are doing. So when you feed an input port to its own loopback, it will create a massive load of MIDI events going round in circles at maximum speed - that will definitely completely overwhelm Cantabile’s engine.

It’s a bit like “oh, there is a loud noise when I hold my microphone in front of the speaker - can this be fixed?”

Sure, @brad could probably create a function that could detect a feedback cycle in MIDI routes, but that would probably come at a performance cost. I wouldn’t really want that…

Yes, that’s what I assumed what was happening.

I imagine (though not checked) you could cause the same issue by looping around midi inputs and outputs without the loopback.

I find it’s often easy to second-guess a developer (ex-developer, tech leader here), and to make incorrect assumptions around simplicity and impact of a fix. You might be right, but we could also both be wrong about the whole thing.

If you mean physically connecting MIDI inputs and outputs: there is at least the limited data rate of “classic” MIDI interfaces as a mitigating factor; still, creating a physical MIDI loop is also not advised - have experienced it completely lock down a synth setup (but easily resolved by pulling a cable :wink: ).

This is a known issue, logged here in a Trello list labelled “Unlikely” - which is a hint to how likely I am to fix it. :slight_smile:

The problem is that detecting infinite loops here is really hard when you consider that any number of filters might be added to the MIDI stream as it passes through Cantabile. ie: if the events are changing each cycle it makes it really hard to determine if there is an event feedback type situation going on. There are heuristics that I could use to hint that something like this is going on, but I don’t like non-deterministic behaviour such as that.


No problem @brad, that what we had assumed. I guess the fix is for me not to be clumsy in future :slight_smile:

I did wonder if an dedicated circular buffer with a bloom filter would be efficient (how big, how many buffers?), but then I’m going to stop because this is turning into a smug report