MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.18k stars 351 forks source link

100% core usage when music paused #1265

Closed ca5ua1 closed 3 years ago

ca5ua1 commented 3 years ago

Bug report

Describe the bug

I get 100% core usage by mpd when music paused

Expected Behavior

pause without 100% core usage

Actual Behavior

100% core usage image

Version

 ~  mpd --version                                                           Wed 22 Sep 2021 08:04:03 PM MSK
Music Player Daemon 0.23~git (v0.22.11-535-g6ed4aff4d+)
Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright 2008-2021 Max Kellermann <max.kellermann@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins:
 simple proxy upnp

Storage plugins:
 local udisks nfs curl

Neighbor plugins:
 upnp udisks

Decoders plugins:
 [mad] mp3 mp2
 [mpg123] mp3
 [vorbis] ogg oga
 [oggflac] ogg oga
 [flac] flac
 [opus] opus ogg oga
 [sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
 [audiofile] wav au aiff aif
 [dsdiff] dff
 [dsf] dsf
 [hybrid_dsd] m4a
 [faad] aac
 [mpcdec] mpc
 [wavpack] wv
 [modplug] 669 amf ams dbm dfm dsm far it med mdl mod mtm mt2 okt s3m stm ult umx xm
 [mikmod] amf dsm far gdm imf it med mod mtm s3m stm stx ult uni xm
 [sidplay] sid mus str prg P00
 [wildmidi] mid
 [fluidsynth] mid
 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve rtp:// rtsp:// rtsps://
 [gme] ay gbs gym hes kss nsf nsfe rsn sap spc vgm vgz
 [pcm]

Filters:
 libsamplerate soxr

Tag plugins:
 id3tag

Output plugins:
 shout null fifo pipe alsa ao oss openal solaris pipewire pulse jack httpd snapcast recorder

Encoder plugins:
 null vorbis opus lame twolame wave flac

Archive plugins:
 [bz2] bz2
 [zzip] zip
 [iso] iso

Input plugins:
 file io_uring archive alsa qobuz curl ffmpeg nfs mms cdio_paranoia

Playlist plugins:
 extm3u m3u pls xspf asx rss soundcloud flac cue embcue

Protocols:
 file:// alsa:// cdda:// ftp:// ftps:// gopher:// hls+http:// hls+https:// http:// https:// mms:// mmsh:// mmst:// mmsu:// nfs:// qobuz:// rtmp:// rtmpe:// rtmps:// rtmpt:// rtmpte:// rtmpts:// rtp:// rtsp:// rtsps:// scp:// sftp:// smb:// srtp://

Other features:
 avahi dbus udisks epoll icu inotify ipv6 systemd tcp un

mpd.conf

 bind_to_address "127.0.0.1"
 #bind_to_address "~/.mpd/socket"
 music_directory "/mnt/General_HDD/Music/"  #"/home/casual/Music/"
 playlist_directory "~/.mpd/playlists"   
 db_file      "~/.mpd/mpd.db"  
 log_file      "~/.mpd/mpd.log"  
 pid_file      "~/.mpd/mpd.pid"  
 state_file     "~/.mpd/mpdstate"  
 user "casual"

restore_paused      "yes"
auto_update         "yes"

audio_output {
        type            "pipewire"
        name            "PipeWire Sound Server"
}

Log

Actually nothing out of place can be seen https://pastebin.com/ekgwLCuV

MaxKellermann commented 3 years ago

Please post a perf report

ca5ua1 commented 3 years ago
 perf stat -p 624965                                                     Thu 23 Sep 2021 08:25:12 PM MSK
^C
 Performance counter stats for process id '624965':

         20,094.26 msec task-clock:u              #    0.953 CPUs utilized          
                 0      context-switches:u        #    0.000 /sec                   
                 0      cpu-migrations:u          #    0.000 /sec                   
                 0      page-faults:u             #    0.000 /sec                   
    67,710,438,341      cycles:u                  #    3.370 GHz                    
     1,200,939,226      stalled-cycles-frontend:u #    1.77% frontend cycles idle   
    21,380,802,977      stalled-cycles-backend:u  #   31.58% backend cycles idle    
   145,364,152,334      instructions:u            #    2.15  insn per cycle         
                                                  #    0.15  stalled cycles per insn
    38,027,737,538      branches:u                #    1.892 G/sec                  
         1,072,241      branch-misses:u           #    0.00% of all branches        

      21.086173802 seconds time elapsed
ca5ua1 commented 3 years ago

oh, wait, report (have never used perf)

ca5ua1 commented 3 years ago

image

MaxKellermann commented 3 years ago

Thanks, that looks useful. I'll look into it.