Bug 90025 - Arts + MP3 causing hard lockup
Summary: Arts + MP3 causing hard lockup
Status: RESOLVED FIXED
Alias: None
Product: akodelib
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Allan Sandfeld
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-22 17:02 UTC by Steve
Modified: 2004-11-04 18:45 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve 2004-09-22 17:02:51 UTC
Version:           1.3.0 (using KDE KDE 3.3.0)
Installed from:    Compiled From Sources
Compiler:          GCC 3.3 CFLAGS="-Os -march=pentium4 -fomit-frame-pointer -pipe" CXXFLAGS=$CFLAGS
OS:                Linux

Playing MP3s in Amarok / KDE.
The music stops at a particular point in the playlist, and keyboard / mouse are unresponsive. 
Ctrl + alt + bkspc - nothing. 
Ctrl + alt + sysrq works, so this is not a kernel panic. 

Reboot, try to play the same playlist again and the same thing happens :-(  
 
It seems that trying to play one particular MP3 through arts (amarok, noatun, kaboodle etc.) is locking up the system. 
 
Mpg123 plays that track just fine.
Trying to play the track with artsplay locks up the machine, even from a terminal.

Madplay prints a continuous stream of 'CRC error in frame xxx' errors untill killed. Using the '-i' option (ignore crc) plays fine. 
 
NO messages in any logs. 
 
I suppose I could just re-encode the MP3, but this SHOULD NOT HAPPEN!!! 
 
Bug in arts? 
Bug in libmad? 
 
KDE 3.3 
ARTS 1.3.0 
Kernel 2.6.5 
Kernel headers 2.6.6 
Libmad 0.15.1b 
ALSA 1.0.5 
GCC 3.3 
GLIBC 2.3.3 + NPTL 
 
CFLAGS="-Os -march=pentium4 -fomit-frame-pointer -pipe" 

I can email the offendng MP3 if need be.
 
Any ideas?? 
 
Steve.
Comment 1 Allan Sandfeld 2004-09-22 17:26:18 UTC
Open a konsole, kill artsd: "killall artsd2, and start artsd with debugging: "artsd -l0". 
Report what it prints, it also shouldn't be able to lockup the system in this state.
Comment 2 Steve 2004-09-22 18:21:13 UTC
Output of artsd -l0:

artsd version is 1.3.0
gsl: using Unix98 pthreads directly for mutexes and conditions
[artsd: 10563] SoundServerStartup --> got lock
autodetecting driver:
 - toss: 4
 - null: -1
 - alsa: 15
 - oss: 10
... which means we'll default to alsa
ALSA driver: default
buffering: 7 fragments with 1024 bytes (audio latency is 40.6 ms)
ALSA lib pcm_hw.c:549:(snd_pcm_hw_start) SNDRV_PCM_IOCTL_START failed: Broken pipe
Closing ALSA-driver
virtualize StereoVolumeControl
ALSA driver: default
buffering: 7 fragments with 1024 bytes (audio latency is 40.6 ms)
ALSA lib pcm_hw.c:549:(snd_pcm_hw_start) SNDRV_PCM_IOCTL_START failed: Broken pipe
audio format is 44100 Hz, 16 bits, 2 channels
addDirectory(/usr/kde/3.3/lib/mcop,)
addDirectory(/usr/kde/3.3/lib/mcop/Amarok,Amarok)
addDirectory(/usr/kde/3.3/lib/mcop/Arts,Arts)
addDirectory(/usr/kde/3.3/lib/mcop/Arts/Environment,Arts::Environment)
addDirectory(/usr/kde/3.3/lib/mcop/Noatun,Noatun)
addDirectory(/home/steve/.mcop/trader-cache,)
Arts::MidiManager registered successfully.
[artsd: 10563] SoundServerStartup <-- released lock
UnixManager: got notifyIO
socketconnection created, fd = 8
search playobject, extension = mp3
creating akodeMPEGPlayObject to play file /home/steve/Desktop/GARBAGE #1 Crush.mp3
akode: opening /home/steve/Desktop/GARBAGE #1 Crush.mp3
akode: play
akode: eof
akode: halt
----------------------------------

Artsd consumes all availabe cpu time, does not respond to ctrl-c, and must be killed with -9.
It doesn't take the whole system with it though :-)

Cheers.

Steve.
Comment 3 Allan Sandfeld 2004-09-22 21:37:03 UTC
Sounds like some odd error state. Send the problematic file directly to me at kde@carewolf.com, and I will have a look at what goes wrong.
Comment 4 Allan Sandfeld 2004-11-04 17:18:48 UTC
What is status?

Is it still a problem, do you an example file you can send me?
Comment 5 Steve 2004-11-04 17:36:00 UTC
Sorry man, I thought I did. turns out I hit reply (wrong email) will send to kde(at)karewolf.com
Comment 6 Allan Sandfeld 2004-11-04 18:19:59 UTC
On Thursday 04 November 2004 17:36, Steve wrote:
> Sorry man, I thought I did. turns out I hit reply (wrong email)
> will send to kde(at)karewolf.com

You better not. My domain is carewolf.com :)

Comment 7 Steve 2004-11-04 18:37:28 UTC
All good, just annother damn typo, I meant care with a c :-)
Comment 8 Allan Sandfeld 2004-11-04 18:45:30 UTC
CVS commit by carewolf: 

Two changes:
 * Also add retry counter on first-frame seeking to avoid locking on 
   completely incorrect files
 * Ask MADlib to ignore CRCs, it is pretty useless anyway.
BUG: 90025 


  M +9 -2      mpeg_decoder.cpp   1.9


--- kdemultimedia/akode/plugins/mpeg_decoder/mpeg_decoder.cpp  #1.8:1.9
@@ -118,5 +118,5 @@ MPEGDecoder::MPEGDecoder(File *src) {
     mad_synth_init(&m_data->synth);
 
-    mad_stream_options(&m_data->stream, 0);
+    mad_stream_options(&m_data->stream, MAD_OPTION_IGNORECRC);
 
     m_data->eof = false;
@@ -364,8 +364,15 @@ bool MPEGDecoder::readFrame(AudioFrame* 
         if (!prepare()) return false;
 
+        int retries = 0;
     first_frame:
+        if (retries >= 8) {
+            // fatal error
+            m_data->error = true;
+            return false;
+        }
         res = mad_frame_decode(&m_data->frame, &m_data->stream);
         if (res != 0) {
             if (m_data->stream.error == MAD_ERROR_BUFLEN) {
+                retries++;
                 moreData(true);
             }
@@ -376,5 +383,5 @@ bool MPEGDecoder::readFrame(AudioFrame* 
             if (MAD_RECOVERABLE(m_data->stream.error)) {
                 #ifdef MPEG_DEBUG
-                cerr << "Invalid frame\n";
+                cerr << "Invalid frame: " << mad_stream_errorstr(&m_data->stream) << "\n";
                 #endif
                 m_data->metaframe_filter(true);