Carla crash with too many SFZs loaded

Programming applications for making music on Linux.

Moderators: MattKingUSA, khz

Post Reply
User avatar
noedig
Established Member
Posts: 233
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa
Has thanked: 9 times
Been thanked: 52 times

Carla crash with too many SFZs loaded

Post by noedig »

When I load a bunch of SFZs in Carla, enough to push my memory use to about 60% or more, Carla crashes after a minute or so of playing. Sending lots of MIDI notes helps it crash faster :)

Running Carla in gdb gives the error message

Code: Select all

*** Error in `/usr/bin/python3': double free or corruption (fasttop): 0x00007fff740008f0 ***
followed by a backtrace, a memory map and finally

Code: Select all

[Switching to Thread 0x7fffd40a5700 (LWP 6491)]
0x00007ffff7825428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
54      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
Any idea what the reason is and whether this is due to Carla, Linuxsampler, JACK and/or the high memory use?
User avatar
noedig
Established Member
Posts: 233
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa
Has thanked: 9 times
Been thanked: 52 times

Re: Carla crash with too many SFZs loaded

Post by noedig »

Ah damn, that's bad news.

Coincidentally, it helped me track down a bug in my own code that had a very similar symptom.

But this is quite depressing. Having based so much of my workflow on something with such a fundamental (it seems) bug, for which the fix feels so far out of grasp.
varpa
Established Member
Posts: 509
Joined: Fri Feb 25, 2011 6:40 pm
Been thanked: 13 times

Re: Carla crash with too many SFZs loaded

Post by varpa »

What happens if you load the SFZs directly in linuxsampler (using qsampler, for example)?
User avatar
noedig
Established Member
Posts: 233
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa
Has thanked: 9 times
Been thanked: 52 times

Re: Carla crash with too many SFZs loaded

Post by noedig »

I was playing around with this again and noticed that crashes are prone to happen when two or more of the same SFZs are loaded in one Carla (backend) instance.
If I load one SFZ and bombard it with notes from VMPK, everything is fine.
As soon as I load a second of the same SFZ, it crashes after a short moment of note bombardment.
When I load multiple but different SFZs, everything seems stable.

I then ran 10 separate program instances, each hosting one of the same SFZ. Sending MIDI to all at once works fine and stable, plus the total load time is faster since they all load in parallel.

So I was wondering, what if a host creates a new separate process for each SFZ instrument (or any other type, in fact) and automatically takes care of the necessary JACK connections. From the user's perspective it still looks like everything is hosted in the host. The processes are then monitored, and as soon as a process crashes, the host automatically restarts it. One crash doesn't affect the rest of the system.
Is this a dumb idea, or does it have some merit? What do you think of it?
User avatar
noedig
Established Member
Posts: 233
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa
Has thanked: 9 times
Been thanked: 52 times

Re: Carla crash with too many SFZs loaded

Post by noedig »

Will look into that, maybe only next week when I have some free time again.
User avatar
noedig
Established Member
Posts: 233
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa
Has thanked: 9 times
Been thanked: 52 times

Re: Carla crash with too many SFZs loaded

Post by noedig »

falkTX, I notice with the latest version of Carla that loading SFZs is increasingly unstable. It often crashes now, "easier" than before, even when not loading the same SFZ files more than once.
Previously, crashes weren't so prevalent, but now I'll get a crash about 80% of the time when loading a project containing 5 different smallish SFZs.
Are there recent changes that might attribute to this?
User avatar
noedig
Established Member
Posts: 233
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa
Has thanked: 9 times
Been thanked: 52 times

Re: Carla crash with too many SFZs loaded

Post by noedig »

Yes standalone linuxsampler seems stable as far as I can tell.

Currently I'm experimenting with loading each SFZ in a separate application instance, and restarting an instance when it crashes. A sort of bridge mode. This keeps the main program instance stable at least and the user just perceives a delayed startup as he/she sees a crash counter counting up until everything more or less stabalises. Funny enough, this now probably negates your memory saving attempts :P

I'm considering looking into controlling Linuxsampler directly, with liblscp or something. Back when I started, Carla backend just seemed like the quickest to get going, the path of least resistance.

Anyway, thanks for your ongoing efforts.
User avatar
d.healey
Established Member
Posts: 610
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 274 times
Been thanked: 100 times

Re: Carla crash with too many SFZs loaded

Post by d.healey »

falkTX wrote:I replace SFZ handling by something else.
What about the streaming version of SFZero? I know it needs a good deal of work though to make it compatible with more opcodes - if anyone wants to tackle that challenge I'd like to contribute a decent amount to a code bounty.
David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
User avatar
d.healey
Established Member
Posts: 610
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 274 times
Been thanked: 100 times

Re: Carla crash with too many SFZs loaded

Post by d.healey »

falkTX wrote:the streaming version is quite terrible on its design decisions.
new threads and memory are allocated *during playback* (ie, on the processing thread).

there are already a few projects that forked from sfzero, implementing some opcodes here and there.
I did not finish the sfzero move yet (just need to do the quick code of scanning sfz files, likely just use the file basename..).
but anyway, I am keeping track of changes I am doing to carla's sfzero, will do a PR to upstream at some point.
it is hard to tell which one if really upstream now though. too many forks...
Oh I didn't realise carla had an implementation of SFZero, that's great news. We desperately need a free SFZ player that can really make use of the SFZ format.
David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
Lyberta
Established Member
Posts: 681
Joined: Sat Nov 01, 2014 8:15 pm
Location: The Internet
Been thanked: 1 time

Re: Carla crash with too many SFZs loaded

Post by Lyberta »

d.healey wrote:Oh I didn't realise carla had an implementation of SFZero, that's great news. We desperately need a free SFZ player that can really make use of the SFZ format.
Well, I've started work on my own sampler targeting SFZ format, but I'm writing it from scratch so it will take years.
Post Reply