Bug 41

Summary: Cannot load the second instrument (gig::Engine error: Failed to load instrument)
Product: LinuxSampler Reporter: zehnan
Component: gig::EngineAssignee: Christian Schoenebeck <cuse>
Status: CLOSED FIXED    
Severity: normal    
Priority: P2    
Version: SVN Trunk   
Hardware: Other   
OS: Linux   

Description zehnan 2007-03-14 08:30:28 CET
When loading a second instrument after the first one linuxsampler reports:

gig::Engine error: Failed to load instrument, cause: Unknown exception while 
trying to parse gig file.

I have two different gig files. Both load OK if they are loaded first, 
however, the second one always fails. For gui I am using Qsampler and this is 
the output:


09:23:23.065 Client connecting...
09:23:23.069 Server is starting...
09:23:23.070 linuxsampler
09:23:23.085 Server was started with PID=10908.
lscp_client_create: cmd: connect: Connection refused
LinuxSampler 0.4.0.3cvs
Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck
Copyright (C) 2005-2007 Christian Schoenebeck
Detected features: disabled at compile time
Creating Sampler...OK
Registered sampler engines: 'GIG'
Registered MIDI input drivers: ALSA
Registered audio output drivers: ALSA,JACK
Starting LSCP network server (0.0.0.0:8888)...OK
09:23:26.302 Client connecting...
09:23:26.306 Client receive timeout is set to 1000 msec.
09:23:26.308 Client connected.
09:23:26.317 New session: "Untitled1".
LinuxSampler initialization completed. :-)
LSCPServer: Client connection established on socket:4.
LSCPServer: Client connection established on socket:5.
09:23:27.188 New Channel setup...
09:23:46.908 Channel 0 added.
09:23:46.912 Channel 0 Audio driver: JACK.
09:23:46.937 Channel 0 MIDI driver: ALSA.
09:23:46.940 Channel 0 MIDI port: 0.
09:23:46.940 Channel 0 MIDI channel: 0.
09:23:47.212 Channel 0 Engine: GIG.
09:23:47.214 Channel 0 Instrument: "/mnt/ivo/giga/apocalypse/women.gig" (0).
09:23:47.216 Channel 0 MIDI map: 0.
gig::Engine: WARNING, CONFIG_EG_MIN_RELEASE_TIME too big for current audio 
fragment size & sampling rate! May lead to click sounds if voice stealing 
chimes in!
Starting disk thread...OK
Scheduling '/mnt/ivo/giga/apocalypse/women.gig' (Index=0) to be loaded in 
background (if not loaded yet).
Loading gig file '/mnt/ivo/giga/apocalypse/women.gig'...OK
Loading gig instrument ('/mnt/ivo/giga/apocalypse/women.gig',0)...
OK
Caching initial samples...
OK
09:23:52.360 New Channel setup...
09:24:02.036 New Channel setup...
09:24:26.820 Channel 1 added.
09:24:26.822 Channel 1 Audio device: 0.
09:24:26.824 Channel 1 MIDI device: 0.
09:24:26.826 Channel 1 MIDI port: 0.
09:24:26.826 Channel 1 MIDI channel: 1.
09:24:26.830 Channel 1 Engine: GIG.
09:24:26.839 Channel 1 
Instrument: "/mnt/ivo/giga/piano/PMI_Bosendorfer_290.gig" (1).
09:24:26.861 Channel 1 MIDI map: 0.
Scheduling '/mnt/ivo/giga/piano/PMI_Bosendorfer_290.gig' (Index=1) to be 
loaded in background (if not loaded yet).
Loading gig file '/mnt/ivo/giga/piano/PMI_Bosendorfer_290.gig'...OK
Loading gig instrument ('/mnt/ivo/giga/piano/PMI_Bosendorfer_290.gig',1)...
OK
Caching initial samples...
gig::Engine error: Failed to load instrument, cause: Unknown exception while 
trying to parse gig file.






Now reversing the order of loading instruments:



09:27:08.327 Client connecting...
09:27:08.330 Server is starting...
09:27:08.331 linuxsampler
09:27:08.336 Server was started with PID=10937.
lscp_client_create: cmd: connect: Connection refused
LinuxSampler 0.4.0.3cvs
Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck
Copyright (C) 2005-2007 Christian Schoenebeck
Detected features: disabled at compile time
Creating Sampler...OK
Registered sampler engines: 'GIG'
Registered MIDI input drivers: ALSA
Registered audio output drivers: ALSA,JACK
Starting LSCP network server (0.0.0.0:8888)...OK
09:27:11.551 Client connecting...
09:27:11.552 Client receive timeout is set to 1000 msec.
09:27:11.552 Client connected.
09:27:11.560 New session: "Untitled1".
LinuxSampler initialization completed. :-)
LSCPServer: Client connection established on socket:4.
LSCPServer: Client connection established on socket:5.
09:27:11.980 New Channel setup...
09:27:21.996 Channel 0 added.
09:27:22.004 Channel 0 Audio driver: JACK.
09:27:22.016 Channel 0 MIDI driver: ALSA.
09:27:22.018 Channel 0 MIDI port: 0.
09:27:22.018 Channel 0 MIDI channel: 0.
09:27:22.122 Channel 0 Engine: GIG.
09:27:22.177 Channel 0 
Instrument: "/mnt/ivo/giga/piano/PMI_Bosendorfer_290.gig" (1).
09:27:22.178 Channel 0 MIDI map: 0.
Starting disk thread...OK
Scheduling '/mnt/ivo/giga/piano/PMI_Bosendorfer_290.gig' (Index=1) to be 
loaded in background (if not loaded yet).
Loading gig file '/mnt/ivo/giga/piano/PMI_Bosendorfer_290.gig'...OK
Loading gig instrument ('/mnt/ivo/giga/piano/PMI_Bosendorfer_290.gig',1)...
OK
Caching initial samples...
OK
09:27:30.028 New Channel setup...
09:27:36.132 Channel 1 added.
09:27:36.134 Channel 1 Audio device: 0.
09:27:36.136 Channel 1 MIDI device: 0.
09:27:36.138 Channel 1 MIDI port: 0.
09:27:36.138 Channel 1 MIDI channel: 1.
09:27:36.143 Channel 1 Engine: GIG.
09:27:36.156 Channel 1 Instrument: "/mnt/ivo/giga/apocalypse/women.gig" (0).
09:27:36.178 Channel 1 MIDI map: 0.
Scheduling '/mnt/ivo/giga/apocalypse/women.gig' (Index=0) to be loaded in 
background (if not loaded yet).
Loading gig file '/mnt/ivo/giga/apocalypse/women.gig'...OK
Loading gig instrument ('/mnt/ivo/giga/apocalypse/women.gig',0)...
gig::Engine error: Failed to load instrument, cause: Unknown exception while 
trying to parse gig file.


After the failiure the sounds still play until you try to add/change a 
channel, after that linuxsampler seems to stop responding:


09:28:22.700 Channel 1 setup...
09:28:35.988 Channel 1 Audio device: 0.
09:28:35.990 Channel 1 MIDI device: 0.
09:28:35.992 Channel 1 MIDI port: 0.
09:28:35.994 Channel 1 MIDI channel: 1.
09:28:36.993 Channel 1 lscp_load_engine: Timeout during receive operation 
(errno=-4)
09:28:37.999 Channel 1 lscp_load_instrument: Failure during flush timeout 
operation (errno=-4)
09:28:39.003 Channel 1 lscp_set_channel_midi_map: Timeout during receive 
operation (errno=-4)
09:28:39.006 Channel 1 Some channel settings could not be set. Sorry.
Thread creation failed: System doesn't allow to create another thread.
09:28:40.015 Channel 1 lscp_get_channel_info: Failure during flush timeout 
operation (errno=-4)
09:28:40.021 Channel 1 Could not get channel information. Sorry.
09:28:42.950 Channel 1 lscp_get_channel_info: Timeout during receive operation 
(errno=-4)
09:28:42.955 Channel 1 Could not get channel information. Sorry.
09:28:44.790 Channel 1 lscp_get_channel_info: Failure during flush timeout 
operation (errno=-4)
09:28:44.796 Channel 1 Could not get channel information. Sorry.
09:28:49.542 Channel 1 lscp_get_channel_info: Failure during flush timeout 
operation (errno=-4)
09:28:49.548 Channel 1 Could not get channel information. Sorry.
09:28:51.776 Channel 1 lscp_get_channel_info: Timeout during receive operation 
(errno=-4)
09:28:51.785 Channel 1 Could not get channel information. Sorry.
09:28:53.889 Channel 1 lscp_get_channel_info: Failure during flush timeout 
operation (errno=-4)
09:28:53.897 Channel 1 Could not get channel information. Sorry.
09:28:59.288 Channel 1 lscp_get_channel_info: Failure during flush timeout 
operation (errno=-4)
09:28:59.297 Channel 1 Could not get channel information. Sorry.
09:29:01.331 Channel 1 lscp_get_channel_info: Timeout during receive operation 
(errno=-4)
09:29:01.338 Channel 1 Could not get channel information. Sorry.
Comment 1 Christian Schoenebeck 2007-03-15 14:40:01 CET
It seems like this exception occurs while trying to cache the sample starts.

You are using latest CVS version of libgig, linuxsampler, liblscp and 
qsampler, right?

What is the audio fragment size you are using in this scenarion? You can check 
that in the "devices" dialog of qsampler.

Does raising the audio fragment size avoid the problem?
Comment 2 zehnan 2007-03-18 12:28:32 CET
(In reply to comment #1)

 
> You are using latest CVS version of libgig, linuxsampler, liblscp and 
> qsampler, right?

I just picked the latest one to be sure.
 
> What is the audio fragment size you are using in this scenarion? You can 
check 
> that in the "devices" dialog of qsampler.

Normally I'd use jack with 64 frames, but I also tested everything with ALSA 
with both 128 and 256 fragment size. 

I just did some more testing and found out that I don't need to load two 
instruments, the error can happen using only one. Loading only PMI Bosendorfer 
290 piano and its first instrument 'Wet B290 8-layer + sustain' I also get the 
same error. I do remeber this instrument working in previous versions of 
linuxsampler. 

On the other hand there is no problem loading lots of smaller gigs. It seems 
like the error comes up when using big gig files.

My system is x86_64 if that's of any significance.




 




Comment 3 Christian Schoenebeck 2007-03-24 10:29:49 CET
Ok, so it's not the fragment size.

Would you please check if you can use the command line tools 'gigdump' 
and 'gigextract' on that Gigasampler files and tell me whether it caused some 
errors or not? Those two tools usually come with libgig.
Comment 4 Christian Schoenebeck 2007-03-24 10:33:48 CET
Of course it could also be a x64 problem. I think none of the LS developers 
have a 64 bit box yet. So if you could test the same scenario on a 32 bit box, 
that might be helpful as well.
Comment 5 zehnan 2007-03-31 10:37:37 CEST
I found the source of the problem and this is how I solved it. 

I raised my memlock in /etc/security/limits.conf from 250000 to 500000:

@audio          -       memlock         500000

So, ulimit -l now reports 500000 and linuxsampler happily loads the big 
instruments that previously failed with the unknown exeption. 

Thanks,
Marko