Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe a deadlock between consumer and producer in player.c #1184

Open
FredericHamel opened this issue Apr 7, 2022 · 10 comments
Open

Maybe a deadlock between consumer and producer in player.c #1184

FredericHamel opened this issue Apr 7, 2022 · 10 comments

Comments

@FredericHamel
Copy link

FredericHamel commented Apr 7, 2022

These are the sequences I do to freeze the cmus.

Sequence 1

  1. Start playing a track
  2. Press 'c' to pause the track.
  3. Press 'v' to stop the track
    Expected result: the track is stop
    Actual result: the player is frozen

Sequence 2

  1. Start playing a track
  2. Press 'c' to pause
  3. Press 'q' and quit.
    Expected result: cmus exits
    Actual result: cmus hang. Probably a deadlock between consumer and producer.

Note: cmus exit correctly without freezing if it is in the playing state or stopped state.
I tried to debug the consumer and producer threads, I notice one of the thread was stuck on either a mutex or condition variable.


  1. uname -a:
Linux akaii-ryzen 5.16.16-artix1-1 #1 SMP PREEMPT Tue, 22 Mar 2022 12:25:22 +0000 x86_64 GNU/Linux
  1. cmus --version:
cmus v2.9.1
  1. cmus --plugins:
Input Plugins: /usr/lib/cmus/ip
  mad:
    Priority: 55
    File Types: mp3 mp2
    MIME Types: audio/mpeg audio/x-mp3 audio/x-mpeg
  opus:
    Priority: 50
    File Types: opus
    MIME Types:
  flac:
    Priority: 50
    File Types: flac fla
    MIME Types:
  modplug:
    Priority: 50
    File Types: mod s3m xm it 669 amf ams dbm dmf dsm far mdl med mtm okt ptm stm ult umx mt2 psm
    MIME Types:
  wavpack:
    Priority: 50
    File Types: wv
    MIME Types: audio/x-wavpack
  aac:
    Priority: 50
    File Types: aac
    MIME Types: audio/aac audio/aacp
  wav:
    Priority: 50
    File Types: wav
    MIME Types:
  vorbis:
    Priority: 50
    File Types: ogg oga ogx
    MIME Types: application/ogg audio/x-ogg
  cdio:
    Priority: 50
    File Types:
    MIME Types: x-content/audio-cdda
  mpc:
    Priority: 50
    File Types: mpc mpp mp+
    MIME Types: audio/x-musepack
  cue:
    Priority: 50
    File Types:
    MIME Types: application/x-cue
  ffmpeg:
    Priority: 30
    File Types: aa aac ac3 aif aifc aiff ape au fla flac m4a m4b mka mkv mp+ mp2 mp3 mp4 mpc mpp ogg opus shn tak tta wav webm wma wv
    MIME Types:

Output Plugins: /usr/lib/cmus/op
  pulse
  alsa
  oss
  jack
  ao
@FredericHamel
Copy link
Author

The issue happen in op_close.The issue may be in pipewire-pulse.

@pgaskin
Copy link
Collaborator

pgaskin commented Apr 8, 2022

The issue may be in pipewire-pulse.

I agree since this only started happening for me recently.

@FredericHamel
Copy link
Author

I am not sure but I think the issue might have been solve in pipewire. I tried the above sequences and I got the expected result in both cases.
Can someone verify in their configuration if the problem is still happening?

@FredericHamel
Copy link
Author

The problem is still there.

@philippemilink
Copy link
Contributor

I encounter the same bug, reproductible with the following steps:

  1. Start playing a track
  2. Press 'c' to pause
  3. Wait some time (usually more than a hour)
  4. Press 'q' to quit.

The interface closes, but it takes several dozens of seconds for cmus to really exit.

@er888kh
Copy link

er888kh commented Jun 29, 2022

@philippemilink
Do you use pipewire? Can you check my workaround (#1172)? I had the same problem with earlier versions of pipewire but last time I checked there was no problem anymore.

@philippemilink
Copy link
Contributor

@philippemilink Do you use pipewire? Can you check my workaround (#1172)? I had the same problem with earlier versions of pipewire but last time I checked there was no problem anymore.

Sorry for the late reply. Yes, I'm using pipewire and your workaround fixes the bug. Thanks!

@Dano507
Copy link

Dano507 commented Sep 3, 2022

Getting the same UI freezing with the sequence Ctrl+s. The current song continues but the UI freezes completely except for when the window gets resized to a smaller size

Also confirming that the other sequences mentioned by @FredericHamel still cause freezing.

cmus version: cmus v2.10.0
uname -a: Linux hostname 5.19.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 29 Aug 2022 15:51:05 +0000 x86_64 GNU/Linux
audio server: pipewire

@er888kh
Copy link

er888kh commented Sep 3, 2022

@Dano507
Are you sure this freezing is not related to software flow control?

@Dano507
Copy link

Dano507 commented Sep 5, 2022

@Dano507 Are you sure this freezing is not related to software flow control?

Thanks for pointing that out @er888kh. My freezing sequence was related to software flow control and Ctrl+q unfroze the terminal.

ologantr added a commit to ologantr/void-packages that referenced this issue Sep 19, 2022
This patch fixes cmus freezing on exit using
both cmus-pulseaudio and pipewire-pulse.

Original bug report: cmus/cmus#1184
Patch from: cmus/cmus#1172
Debian: https://salsa.debian.org/multimedia-team/cmus/-/commit/2e20a489bc58a604a0093830d71e43a5ac2b6c51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants