Bug 7

Summary: Hard crash as voice count gets to 128
Product: LinuxSampler Reporter: Mark Knecht <markknecht>
Component: gig::EngineAssignee: Christian Schoenebeck <cuse>
Status: CLOSED FIXED    
Severity: normal    
Priority: P2    
Version: SVN Trunk   
Hardware: PC   
OS: Linux   

Description Mark Knecht 2005-03-15 04:29:16 CET
Hi. I'm pushing the new CVS version hard (as usual) and it's still crashing. The
crash is repeatable. All voice count values are default.

What I noticed was that CPU got to 100% a couple of times just before the crash.
It appears that the strings group (Engine 0) used up 128 voices, or something
very close to that, right around crash time. It had seen a high of 105 voices
sometime around 1 minute earlier:

Engine 0) Voices: 096 (Max: 105) Streams: 084 (Max: 105)
Engine 1) Voices: 000 (Max: 016) Streams: 000 (Max: 016)
Engine 2) Voices: 006 (Max: 018) Streams: 006 (Max: 016)
Engine 3) Voices: 000 (Max: 052) Streams: 000 (Max: 052)
Engine 0) Voices: 000 (Max: 117) Streams: 000 (Max: 117)
Engine 1) Voices: 000 (Max: 016) Streams: 000 (Max: 016)
Engine 2) Voices: 005 (Max: 018) Streams: 005 (Max: 016)
Engine 3) Voices: 000 (Max: 052) Streams: 000 (Max: 052)
Engine 0) Voices: 088 (Max: 117) Streams: 087 (Max: 117)
Engine 1) Voices: 000 (Max: 016) Streams: 000 (Max: 016)
Engine 2) Voices: 008 (Max: 018) Streams: 009 (Max: 016)
Engine 3) Voices: 000 (Max: 052) Streams: 000 (Max: 052)
Engine 0) Voices: 009 (Max: 117) Streams: 009 (Max: 117)
Engine 1) Voices: 000 (Max: 016) Streams: 000 (Max: 016)
Engine 2) Voices: 005 (Max: 018) Streams: 005 (Max: 016)
Engine 3) Voices: 000 (Max: 052) Streams: 000 (Max: 052)
Engine 0) Voices: 110 (Max: 117) Streams: 117 (Max: 117)
Engine 1) Voices: 000 (Max: 016) Streams: 000 (Max: 016)
Engine 2) Voices: 007 (Max: 018) Streams: 007 (Max: 016)
Engine 3) Voices: 000 (Max: 052) Streams: 000 (Max: 052)
Engine 0) Voices: 110 (Max: 125) Streams: 114 (Max: 125)
Engine 1) Voices: 000 (Max: 016) Streams: 000 (Max: 016)
Engine 2) Voices: 007 (Max: 018) Streams: 007 (Max: 016)
Engine 3) Voices: 000 (Max: 052) Streams: 000 (Max: 052)
Engine 0) Voices: 096 (Max: 126) Streams: 096 (Max: 125)
Engine 1) Voices: 000 (Max: 016) Streams: 000 (Max: 016)
Engine 2) Voices: 007 (Max: 018) Streams: 007 (Max: 016)
Engine 3) Voices: 000 (Max: 052) Streams: 000 (Max: 052)

Here's what I could get from a backtrace:

0xffffe410 in ?? ()
(gdb) continue
Continuing.
 
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1219929168 (LWP 11211)]
LinuxSampler::gig::Engine::StealVoice (this=0x8077290, pEngineChannel=0x98c3f88,
    itNoteOnEvent=@0xb74958c0) at Voice.h:141
141                 Pool<Event>::Iterator       itKillEvent;         ///< Event
which caused this voice to be killed
(gdb) bt
#0  LinuxSampler::gig::Engine::StealVoice (this=0x8077290, pEngineChannel=0x98c3f88,
    itNoteOnEvent=@0xb74958c0) at Voice.h:141
#1  0xb7f75701 in LinuxSampler::gig::Engine::LaunchVoice (this=0x8077290,
    pEngineChannel=0x98c3f88, itNoteOnEvent=@0xb74958c0, iLayer=1,
ReleaseTriggerVoice=false,
    VoiceStealing=true) at Engine.cpp:684
#2  0xb7f74f98 in LinuxSampler::gig::Engine::ProcessNoteOn (this=0x8077290,
    pEngineChannel=0x98c3f88, itNoteOnEvent=@0xb7495940) at Engine.cpp:571
#3  0xb7f74545 in LinuxSampler::gig::Engine::ProcessEvents (this=0x8077290,
    pEngineChannel=0xb7495940, Samples=1024) at Pool.h:135
#4  0xb7f742b3 in LinuxSampler::gig::Engine::RenderAudio (this=0x8077290,
Samples=1024)
    at ArrayList.h:131
#5  0xb7fb349e in LinuxSampler::AudioOutputDevice::RenderAudio (this=0x80516d8,
Samples=1024)
    at stl_tree.h:199
#6  0xb7fc64cb in LinuxSampler::AudioOutputDeviceJack::Process (this=0x80516d8,
Samples=1024)
    at AudioOutputDeviceJack.cpp:207
#7  0xb7fc682a in LinuxSampler::__libjack_process_callback (nframes=0, arg=0x0)
    at AudioOutputDeviceJack.cpp:260
#8  0x4364c58a in jack_port_type_size () from /usr/lib/libjack.so.0
#9  0x00000400 in ?? ()
#10 0x080516d8 in ?? ()
#11 0x00000582 in ?? ()
#12 0x00000000 in ?? ()
(gdb)

This crash completely shuts down Jack. Here are the messages I got there:

19:13:35.612 MIDI connection graph change.
19:13:35.815 Audio connection change.
19:13:35.816 MIDI connection change.
19:14:40.941 Audio connection graph change.
19:14:40.990 Audio connection graph change.
subgraph starting at LinuxSampler2 timed out (subgraph_wait_fd=26, status = 0,
state = Triggered)
**** alsa_pcm: xrun of at least 1.914 msecs
19:16:09.546 XRUN callback (5).
**** alsa_pcm: xrun of at least 3431.102 msecs
19:16:10.418 XRUN callback (1 skipped).
19:17:51.186 XRUN callback (7).
delay of 46447.000 usecs exceeds estimated spare time of 22836.000; restart ...
subgraph starting at LinuxSampler2 timed out (subgraph_wait_fd=26, status = 0,
state = Finished)
**** alsa_pcm: xrun of at least 1.313 msecs
jackd watchdog: timeout - killing jackd
zombified - calling shutdown handler
19:19:53.487 Shutdown notification.
19:19:53.487 Client deactivated.
19:19:53.488 JACK is stopping...
cannot send request type 7 to server
cannot read result for request type 7 from server (Broken pipe)
cannot send request type 7 to server
cannot read result for request type 7 from server (Broken pipe)
19:19:53.688 JACK was stopped successfully.

Hope this is explanitory. Let me know what info you need to go further.

Thanks!
Comment 1 Christian Schoenebeck 2005-03-15 14:41:28 CET
Were there any error messages just before it crashed? 
Comment 2 Mark Knecht 2005-03-15 14:46:03 CET
There were no messages. The section showing voice count per stream was all that
showed up in the terminal.
Comment 3 Christian Schoenebeck 2005-03-15 17:51:10 CET
Ok, I was able to reproduce this bug with a couple of engine channels and a 
layered sound. I'm on it... 
Comment 4 Christian Schoenebeck 2005-03-15 20:29:36 CET
Fixed with latest CVS. 
Comment 5 Mark Knecht 2005-03-16 01:50:59 CET
This issue is verified as fixed on my end. (Closing this one does make others
more apparent.)

Thanks!
Comment 6 Christian Schoenebeck 2005-03-16 02:07:03 CET
Sure you're right.