Skip to content

Server fails to boot (unpredictably) when explicitly setting the sample rate #2488

@totalgee

Description

@totalgee

This is based on the sc-users thread about this Server boot crash. You can read my "thought process" there, but in summary, here are simplified reproduction steps that fail several times out of ten boot attempts, for me.


Running the following scripts, scsynth crashes sporadically — sometimes every run, then at other moments it runs correctly a bunch of times in a row. Repro steps (possibly not all steps are necessary to cause the crash, but this seems to do it pretty reliably for me):

create two files:

////////// 
// main.scd 
////////// 
( 
{ 
        var subDoneCondition; 
        s.options.sampleRate = 44100; 
        subDoneCondition = "sub.scd".loadRelative.first; 
        subDoneCondition.wait; 
        "main continuing".postln; 
}.fork; 
) 

and

////////// 
// sub.scd 
////////// 
( 
var doneCondition = Condition.new; 
{ 
        SynthDef(\test, { arg out = 0, freq = 440; 
                var sig = SinOsc.ar(freq) * EnvGen.ar(Env.perc(1, 10), doneAction: 2); 
                Out.ar(out, sig ! 2); 
        }).add; 

        "sub about to boot Server".postln; 
        s.waitForBoot { 
                Synth(\test); 
                "sub done".postln; 
                doneCondition.test = true; doneCondition.signal; 
        }; 

}.fork; 

doneCondition; 
) 

Now, in the OS X Terminal, from the directory where those files are located, run the following loop of tests (make sure sclang is on your path):

$ for i in $(seq 1 10); do echo "========== Test # $i"; killall sclang; killall scsynth; sleep 1; (sclang main.scd &); sleep 8; done 

For me, scsynth crashes (doesn’t play any sound and prints the following malloc error message or sometimes just "Server failed to start") about half the time…

scsynth(14163,0x7fff751be000) malloc: *** error for object 0x7fbd60f53b18:
incorrect checksum for freed object - object was probably modified after being freed. 

It may seem a weird example, but imagine that’s an installed piece, and you need to ensure you can stop and start it automatically… It’s really bad that I can’t be sure if it started properly…

This is with downloaded 3.7.2 and OS X 10.11.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues that relate to unexpected/unwanted behavior. Don't use for PRs.comp: scsynthos: macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions