So, LinuxSampler kept crashing on me...

Things that make the work with LinuxSampler & Co easier, better, faster, louder and more sexy. Including friends like JACK, ALSA, etc.
Post Reply
Posts: 1
Joined: Tue Feb 16, 2010 12:48 pm

So, LinuxSampler kept crashing on me...

Post by NavahoGL » Fri Feb 19, 2010 6:39 am

I ran into some issues lately: when flicking an already set-up channels' engine from GIG to SF2 it crashed.

Initially with a SIGFPE (error during arithmetical expression) and, when I put in some code to catch it, it changed into a SIGSEGV, in the DiskReadBufferFillPercentage() routine... I wanted to post about this problem, but I wanted to have a clear idea of it first but I just could not get my head around it.

Until I started looking in my system logs....It was a user error all along: the OOM-Killer was doing it's dirty work!

The machine basically only has JACK and LinuxSampler running and, interestingly, the OOM killer targetted the process requesting the memory, which happened to be the sampler itself, and it died a horrible death.

So I did some Googling around and found out this interesting information, coming from
Any particular process leader may be immunized against the oom killer if the value of its /proc/<pid>/oomadj is set to the constant OOM_DISABLE (currently defined as -17).
(Well, that's actually /proc/<pid>/oom_adj now, but OOM_DISABLE is still -17, so the rest of the theory is still valid.)

Disabling the OOM killer on the LinuxSampler process immediately stopped it from crashing: I could not reproduce the crashes I had before. (There may be other implications, but to me a crashing LinuxSampler equals a crashing machine, so that is something I can live with.)

So now, after JACK and LinuxSampler have started, I immediately call this little script to prevent certain processes from being assassinated. It uses 'pgrep' to figure out a process-name's PID and echo "-17" into it's oom_adj file:

Code: Select all

# Purpose: This script scans the process list for a couple of known
#       processes and shall attempt to set the oom_adj value of that
#       process to OOM_DISABLE (-17)
PROC="linuxsampler jackd"
for P in $PROC;
        PID=`$PGREP $P`
        [ -n "$PID" ] && {
                echo -n "pid $PID, oom_adj was `$CAT /proc/$PID/oom_adj`"
                echo $OOM_DISABLE > /proc/$PID/oom_adj
                echo ", is now `$CAT /proc/$PID/oom_adj`"
I thought I'd share this "trick" in case anyone else runs into problems with the OOM killer. (BTW, I have always imagined the OOM killer to look like Léon (the movie), but dressed in black. But I digress.)

Hope this information is useful to others! Happy Sampling! :-D

Posts: 316
Joined: Wed Jan 23, 2008 9:08 pm

Re: So, LinuxSampler kept crashing on me...

Post by Alex » Sat Feb 27, 2010 8:03 am

Thanks for sharing this.


Post Reply