Holzhaus / mixxx-gh-issue-migration

0 stars 0 forks source link

Mixxx 1.6.0beta2 Segfaults while "Scratching" #12

Closed Holzhaus closed 3 years ago

Holzhaus commented 3 years ago

Reported by: alex-malexmedia Date: 2008-02-17T15:48:35Z Status: Fix Released Importance: Medium Launchpad Issue: lp192663


Using Mixxx on Linux (fc7) with no DRI.

When "scratching" through any track using my new MIDI jog wheel, Mixxx will occasionally segfault. The backtraces always seem to lead to the same place. Here is a sample:

[alex@rockit2 ~]$ gdb mixxx
GNU gdb Red Hat Linux (6.6-16.fc7rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: /usr/local/bin/mixxx 
[Thread debugging using libthread_db enabled]
[New Thread -1209030960 (LWP 4806)]
Debug: Starting up...
[New Thread -1215960176 (LWP 4809)]
[New Thread -1231176816 (LWP 4810)]
[New Thread -1250686064 (LWP 4811)]
Debug: SoundManager::SoundManager() 
Debug: SampleRate 44100 
Debug: Latency 36 
Debug: SoundManager::queryDevices() 
Debug: SoundManager::clearDeviceList() 
Debug: SoundManager::closeDevices() 
[New Thread -1264178288 (LWP 4812)]
[Detaching after fork from child process 4813. (Try `set detach-on-fork off'.)]
Debug: type signal
Debug: type marks
Debug: type signal
Debug: type marks
[New Thread -1274668144 (LWP 4814)]
[New Thread -1285158000 (LWP 4815)]
Debug: Loading playlists and library tracks from XML... 
Debug: Track::readXML "/home/alex/.mixxxtrack.xml" 
Debug: Break
Debug: Constructed LibraryScanner!!! 
Debug: No playlists, returning 
Debug: FIXME: Need to tell the m_pPlaylistListModel to refresh in src/track.cpp on line: 1120 
Debug: Trying to add 119 songs to the library playlist 
Debug: Adjusting column widths: tracktable width = 582  1% of that is: 5.82  FIXME: this should be done when initalizing the skin. 
Debug: Shrinking Title/Comment for small screen...  
Debug: selectedAPI is:  "ALSA" 
Debug: SoundManager::getDeviceList 
Debug: SoundManager::getDeviceList 
Debug: SoundManager::getDeviceList 
[New Thread -1298138224 (LWP 4816)]
Debug: PowerMate: write(): Bad file descriptor
Debug: PowerMate: write(): Bad file descriptor
Debug: m_pHercules init: 0xb5e6b880
[New Thread -1308628080 (LWP 4817)]
Debug: Midi OK (Workaround not required)
Debug: setupMappings( "/usr/local/share/mixxx/midi/Numark Total Control.midi.xml" ) 
[Thread -1308628080 (LWP 4817) exited]
Debug: Found option "invert" 
Debug: Option: 1
Debug: Found option "diff" 
Debug: Option: 5
Debug: Setting "jog" sensitivity to 10 
Debug: Found option "diff" 
Debug: Option: 5
Debug: Setting "jog" sensitivity to 10 
Debug: Found option "diff" 
Debug: Option: 5
Debug: loadSettings: 1 0 "SlowFade" 
Debug: slotApply crossfader: 1 "SlowFade" 
Debug: BpmSchemes::readXML "/home/alex/.mixxxbpmscheme.xml" 
Debug: SoundManager::setupDevices() 
Debug: Xwax Vinyl control starting with a sample rate of: 44100 
Debug: Building timecode lookup tables... 
Allocating 2097152 slots (8192Kb) for 20 bit timecode (Serato 2nd Ed., side A)
[New Thread -1308628080 (LWP 4818)]
Debug: Created new VinylControlXwax! 
Debug: Xwax Vinyl control starting with a sample rate of: 44100 
Debug: Building timecode lookup tables... 
[New Thread -1327510640 (LWP 4819)]
Debug: Created new VinylControlXwax! 
Debug: SoundDevicePortAudio::open() "1, HDA ATI SB: ALC883 Analog (hw:0,0)" 
Debug: m_dSampleRate 44100 
Debug: iLatencyMSec: 36 
Debug: output channels: 2 | input channels: 0 
Debug: iLatencySamples: 3176 
Debug: iLatencyMSec: 36 
Debug: Opening stream with id 1 
Debug: Opened PortAudio stream successfully... starting 
[New Thread -1338000496 (LWP 4820)]
Debug: PortAudio: Started stream successfully 
Debug: iNumDevicesOpenedForOutput: 1 
Debug: iNumDevicesOpenedForInput: 0 
Debug: file length 33437952
Debug: WaveSummary generation successful for "Glare-Alive_Again_PM.mp3" 
Debug: ramp in
Debug: BPM detection successful for "Glare-Alive_Again_PM.mp3" 
Debug: ramp in
Debug: ramp in
Debug: ramp in
Debug: ramp in
Debug: ramp in
Debug: ramp in
Debug: ramp in
Debug: ramp in
Debug: ramp in

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1338000496 (LWP 4820)]
0x0815f25c in RateTransposerFloat::transposeStereo (this=0xa2f0620, dest=0xae759940, src=0xa035b20, numSamples=100)
    at lib/soundtouch/RateTransposer.cpp:590
590             dest[2 * i] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleL + fSlopeCount * src[0]);
(gdb) thread apply all bt

Thread 12 (Thread -1338000496 (LWP 4820)):

⁠0 0x0815f25c in RateTransposerFloat::transposeStereo (this=0xa2f0620, dest=0xae759940, src=0xa035b20, numSamples=100)

at lib/soundtouch/RateTransposer.cpp:590

⁠1 0x081602d2 in soundtouch::RateTransposer::transpose (this=0xa2f0620, dest=0xae759940, src=0xa035b20, numSamples=100)

at lib/soundtouch/RateTransposer.cpp:318

⁠2 0x0815f730 in soundtouch::RateTransposer::upsample (this=0xa2f0620, src=0xa035b20, numSamples=100)

at lib/soundtouch/RateTransposer.cpp:231

⁠3 0x0815f8d9 in soundtouch::RateTransposer::processSamples (this=0xa2f0620, src=0xa035b20, numSamples=100)

at lib/soundtouch/RateTransposer.cpp:303

⁠4 0x0815f915 in soundtouch::RateTransposer::putSamples (this=0xa2f0620, samples=0xa035b20, numSamples=100)

at lib/soundtouch/RateTransposer.cpp:212

⁠5 0x0815cc52 in soundtouch::SoundTouch::putSamples (this=0xa1089c0, samples=0xa035b20, numSamples=100)

at lib/soundtouch/SoundTouch.cpp:317

⁠6 0x0815b8c8 in EngineBufferScaleST::scale (this=0xa035860, playpos=604618.23999999987, buf_size=3176, pBase=0xb78fc008,

iBaseLength=819200) at src/enginebufferscalest.cpp:174

⁠7 0x080b5142 in EngineBuffer::process (this=0xa04f670, pOut=0xb5918008, iBufferSize=3176) at src/enginebuffer.cpp:1120

⁠8 0x080e0ed0 in EngineMaster::process (this=0xa081d50, pOut=0x0, iBufferSize=3176) at src/enginemaster.cpp:181

⁠9 0x0814b078 in SoundManager::requestBuffer (this=0xa0aca70, srcs=@0xb03fb210, iFramesPerBuffer=1588)

at src/soundmanager.cpp:440

⁠10 0x0815054c in SoundDevicePortAudio::callbackProcess (this=0xa0adef0, framesPerBuffer=1588, output=0xa331c00, in=0x0,

devIndex=1) at src/sounddeviceportaudio.cpp:305

⁠11 0x081506c2 in paV19Callback (inputBuffer=0x0, outputBuffer=0xa331c00, framesPerBuffer=1588, timeInfo=0xb03fb378,

statusFlags=0, _callbackStuff=0xa0adf30) at src/sounddeviceportaudio.cpp:362

⁠12 0x0032ae8c in AdaptingOutputOnlyProcess (bp=0xa350c94, streamCallbackResult=0xb03fb39c, hostOutputChannels=0xa046df0,

framesToProcess=400) at src/common/pa_process.c:1058

⁠13 0x0032bb59 in PaUtil_EndBufferProcessing (bp=0xa350c94, streamCallbackResult=0xb03fb39c) at src/common/pa_process.c:1581

⁠14 0x0033359d in CallbackThreadFunc (userData=0xa350c48) at src/hostapi/alsa/pa_linux_alsa.c:3303

⁠15 0x0079e44b in start_thread () from /lib/libpthread.so.0

⁠16 0x006cc80e in clone () from /lib/libc.so.6

Thread 11 (Thread -1327510640 (LWP 4819)):
#0  0x00110402 in __kernel_vsyscall ()
#1  0x007a2206 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x001e41f8 in QWaitCondition::wait () from /usr/lib/libQtCore.so.4
#3  0x08172258 in VinylControlXwax::run (this=0xa341098) at src/vinylcontrolxwax.cpp:128
#4  0x001e3917 in ?? () from /usr/lib/libQtCore.so.4
#5  0x0079e44b in start_thread () from /lib/libpthread.so.0
---Type <return> to continue, or q <return> to quit---
#6  0x006cc80e in clone () from /lib/libc.so.6

Thread 10 (Thread -1308628080 (LWP 4818)):
#0  0x00110402 in __kernel_vsyscall ()
#1  0x007a2206 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x001e41f8 in QWaitCondition::wait () from /usr/lib/libQtCore.so.4
#3  0x08172258 in VinylControlXwax::run (this=0xa2b53d8) at src/vinylcontrolxwax.cpp:128
#4  0x001e3917 in ?? () from /usr/lib/libQtCore.so.4
#5  0x0079e44b in start_thread () from /lib/libpthread.so.0
#6  0x006cc80e in clone () from /lib/libc.so.6

Thread 8 (Thread -1298138224 (LWP 4816)):
#0  0x00110402 in __kernel_vsyscall ()
#1  0x006c2a43 in poll () from /lib/libc.so.6
#2  0x08159422 in MidiObjectALSASeq::run (this=0xa104b18) at src/midiobjectalsaseq.cpp:250
#3  0x001e3917 in ?? () from /usr/lib/libQtCore.so.4
#4  0x0079e44b in start_thread () from /lib/libpthread.so.0
#5  0x006cc80e in clone () from /lib/libc.so.6

Thread 7 (Thread -1285158000 (LWP 4815)):
#0  0x00110402 in __kernel_vsyscall ()
#1  0x007a2206 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x001e41f8 in QWaitCondition::wait () from /usr/lib/libQtCore.so.4
#3  0x08124085 in BpmDetector::run (this=0xa0ffe60) at src/bpmdetector.cpp:129
#4  0x001e3917 in ?? () from /usr/lib/libQtCore.so.4
#5  0x0079e44b in start_thread () from /lib/libpthread.so.0
#6  0x006cc80e in clone () from /lib/libc.so.6

Thread 6 (Thread -1274668144 (LWP 4814)):
#0  0x00110402 in __kernel_vsyscall ()
#1  0x007a2206 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x001e41f8 in QWaitCondition::wait () from /usr/lib/libQtCore.so.4
#3  0x08123074 in WaveSummary::run (this=0xa0fd5e0) at src/wavesummary.cpp:81
#4  0x001e3917 in ?? () from /usr/lib/libQtCore.so.4
#5  0x0079e44b in start_thread () from /lib/libpthread.so.0
#6  0x006cc80e in clone () from /lib/libc.so.6

Thread 5 (Thread -1264178288 (LWP 4812)):
---Type <return> to continue, or q <return> to quit---
#0  0x00110402 in __kernel_vsyscall ()
#1  0x006c5561 in select () from /lib/libc.so.6
#2  0x0026f69f in ?? () from /usr/lib/libQtCore.so.4
#3  0x001e3917 in ?? () from /usr/lib/libQtCore.so.4
#4  0x0079e44b in start_thread () from /lib/libpthread.so.0
#5  0x006cc80e in clone () from /lib/libc.so.6

Thread 4 (Thread -1250686064 (LWP 4811)):
#0  0x00110402 in __kernel_vsyscall ()
#1  0x007a2206 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x001e41f8 in QWaitCondition::wait () from /usr/lib/libQtCore.so.4
#3  0x081527fc in EngineSideChain::run (this=0xa08aeb8) at src/enginesidechain.cpp:145
#4  0x001e3917 in ?? () from /usr/lib/libQtCore.so.4
#5  0x0079e44b in start_thread () from /lib/libpthread.so.0
#6  0x006cc80e in clone () from /lib/libc.so.6

Thread 3 (Thread -1231176816 (LWP 4810)):
#0  0x00110402 in __kernel_vsyscall ()
#1  0x007a2206 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x001e41f8 in QWaitCondition::wait () from /usr/lib/libQtCore.so.4
#3  0x080f6211 in Reader::run (this=0xa046218) at src/reader.cpp:256
#4  0x001e3917 in ?? () from /usr/lib/libQtCore.so.4
#5  0x0079e44b in start_thread () from /lib/libpthread.so.0
#6  0x006cc80e in clone () from /lib/libc.so.6

Thread 2 (Thread -1215960176 (LWP 4809)):
#0  0x00110402 in __kernel_vsyscall ()
#1  0x007a2206 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x001e41f8 in QWaitCondition::wait () from /usr/lib/libQtCore.so.4
#3  0x080f6211 in Reader::run (this=0xa032550) at src/reader.cpp:256
#4  0x001e3917 in ?? () from /usr/lib/libQtCore.so.4
#5  0x0079e44b in start_thread () from /lib/libpthread.so.0
#6  0x006cc80e in clone () from /lib/libc.so.6

Thread 1 (Thread -1209030960 (LWP 4806)):
#0  0x00110402 in __kernel_vsyscall ()
#1  0x006c2a43 in poll () from /lib/libc.so.6
#2  0x00372803 in ?? () from /lib/libglib-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#3  0x00372d35 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#4  0x002a8ca8 in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#5  0x03065c95 in ?? () from /usr/lib/libQtGui.so.4
#6  0x00286cc1 in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#7  0x00286dcc in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#8  0x0028917a in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#9  0x02febd77 in QApplication::exec () from /usr/lib/libQtGui.so.4
#10 0x080c3b1e in main (argc=1, argv=0xbfbad444) at src/main.cpp:219
0x0815f25c      590             dest[2 * i] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleL + fSlopeCount * src[0]);
(gdb)
Holzhaus commented 3 years ago

Commented by: @asantoni Date: 2008-02-17T16:50:15Z


Just out of curiosity, what is the jog wheel control set to in your MIDI mapping? (This probably has nothing to do with the problem...)

Holzhaus commented 3 years ago

Commented by: alex-malexmedia Date: 2008-02-17T18:23:40Z


My jog wheels are set like so:

<control>
    <group>[Channel1]</group>
    <key>jog</key>
    <miditype>Ctrl</miditype>
    <midino>25</midino>
    <sensitivity>10</sensitivity>
    <options><diff/></options>
</control>

However, my codebase has a few lines changed in the configobject.cpp which make diff a little saner for my setup.

Holzhaus commented 3 years ago

Commented by: alex-malexmedia Date: 2008-02-17T18:24:50Z


As you requested, I tried to cause the same problem in pitch-independent stretch mode. Mixxx locked up instead of segfaulting, but here is the backtrace.

Holzhaus commented 3 years ago

Commented by: alex-malexmedia Date: 2008-02-17T18:44:16Z


Caused the same segfault while running under valgrind.

Holzhaus commented 3 years ago

Commented by: alex-malexmedia Date: 2008-02-17T22:34:43Z


Fixed!

When the seek speed is too low, we essentially ask SoundTouch to expand our 100-sample buffer into literally gigabytes of RAM. (Which causes SoundTouch to overflow an int and segfault.)

This patch adds MIN_SEEK_SPEED, which successfully prevents such nonsense from ever happening.

Holzhaus commented 3 years ago

Commented by: alex-malexmedia Date: 2008-02-18T01:30:30Z


Discovered another case where soundtouch->setRate() could be called with a super-small number.

sheepish Guess I need to do my homework better...

Holzhaus commented 3 years ago

Issue closed with status Fix Released.