Carla crash with too many SFZs loaded

Programming applications for making music on Linux.

Moderators: khz, MattKingUSA

User avatar
noedig
Establlshed Member
Posts: 104
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa

Carla crash with too many SFZs loaded

Postby noedig » Mon Dec 11, 2017 5:45 pm

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
falkTX
Establlshed Member
Posts: 6587
Joined: Sat Jan 09, 2010 3:04 pm

Re: Carla crash with too many SFZs loaded

Postby falkTX » Mon Dec 11, 2017 5:55 pm

I've seen this too, seems to be related to linuxsampler.
An easier way to make it crash is to play a couple of notes (more than 1) while you remove or add a new SFZ file.

there is a new linuxsampler version, which I need to update to. maybe that fixes this, though I really doubt it.

User avatar
noedig
Establlshed Member
Posts: 104
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa

Re: Carla crash with too many SFZs loaded

Postby noedig » Mon Dec 11, 2017 7:04 pm

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
Establlshed Member
Posts: 419
Joined: Fri Feb 25, 2011 6:40 pm

Re: Carla crash with too many SFZs loaded

Postby varpa » Tue Dec 12, 2017 2:57 am

What happens if you load the SFZs directly in linuxsampler (using qsampler, for example)?

User avatar
falkTX
Establlshed Member
Posts: 6587
Joined: Sat Jan 09, 2010 3:04 pm

Re: Carla crash with too many SFZs loaded

Postby falkTX » Tue Dec 12, 2017 8:15 am

The standalone uses different methods, a better comparison would be against the official LV2 or VST plugin.

User avatar
noedig
Establlshed Member
Posts: 104
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa

Re: Carla crash with too many SFZs loaded

Postby noedig » Thu Jun 07, 2018 6:14 am

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
falkTX
Establlshed Member
Posts: 6587
Joined: Sat Jan 09, 2010 3:04 pm

Re: Carla crash with too many SFZs loaded

Postby falkTX » Thu Jun 07, 2018 7:25 am

I have noticed this too, linuxsampler does not like to have multiple instances of the same instrument running in the same process...
And Carla already does that a little bit - when it detects a 2nd sfz file loaded in a project, it will load it in bridge mode (external process) as otherwise linuxsampler gets confused and quite often makes the 1st sfz sound go mute.
See https://github.com/falkTX/Carla/blob/ma ... e.cpp#L476

Are you able to record/create a MIDI file that always triggers this issue?
If we can reliably reproduce it, it will help a lot to get this fixed.

User avatar
noedig
Establlshed Member
Posts: 104
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa

Re: Carla crash with too many SFZs loaded

Postby noedig » Fri Jun 08, 2018 5:54 am

Will look into that, maybe only next week when I have some free time again.

User avatar
noedig
Establlshed Member
Posts: 104
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa

Re: Carla crash with too many SFZs loaded

Postby noedig » Fri Aug 10, 2018 6:57 am

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
falkTX
Establlshed Member
Posts: 6587
Joined: Sat Jan 09, 2010 3:04 pm

Re: Carla crash with too many SFZs loaded

Postby falkTX » Fri Aug 10, 2018 7:36 am

Yes, a small change to try to make it use less memory (shared instance), but in turn having a lock that prevents multi-threaded loading of instruments.
To be honest, this linuxsampler thing is more trouble than it is worth.

It does not happen with standalone linuxsampler, right?
I think I will give this one last try, more heavier changes soon.
But if it still keeps crashing, I replace SFZ handling by something else.

User avatar
noedig
Establlshed Member
Posts: 104
Joined: Wed Feb 12, 2014 4:39 am
Location: South Africa

Re: Carla crash with too many SFZs loaded

Postby noedig » Fri Aug 10, 2018 9:03 am

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.


Return to “Developer's Section”

Who is online

Users browsing this forum: No registered users and 1 guest