GeorgeFilipkin / pulsemixer

CLI and curses mixer for PulseAudio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SIGSEGV at line 972

knezi opened this issue · comments

Hi,
I am getting SIGSEGV at line 972:

self.ret = pointer(c_int())

Running Arch, python 3.5.1.

Hi. At the moment of getting this segfault - is pulseaudio daemon running?

[knezi@holly ~]$ ps aux|grep pulse
knezi     1100  0.0  0.3 422776 11776 ?        S<sl 18:10   0:00 /usr/bin/pulseaudio --daemonize=no
knezi     1743  0.0  0.0   9644  2264 pts/0    S+   18:13   0:00 grep pulse

EDIT: But tried again, and got:

Traceback (most recent call last):
File "./pulsemixer", line 1784, in <module>
main()
File "./pulsemixer", line 1696, in main
curses.wrapper(Screen().run)
File "./pulsemixer", line 1192, in __init__
curses.init_pair(67, 66, -1)
_curses.error: init_pair() returned ERR

So maybe last time pulseaudio was not running.

Alright, here is what I've managed to figure out.

Since version 7.0 pulseaudio in Arch no longer uses autospawn, but instead uses socket activation via systemd. Here is the commit.
And here is disabled autospawn on a freshly installed system:

$ grep spawn /etc/pulse/client.conf 
autospawn = no

At the moment of getting the segfault pulseaudio simply isn't running and refusing connection to the activation socket. This is the case for every other application that uses pulseaudio, not only pulsemixer:

$ ponymix 
failed to connect to pulse daemon: Connection refused
$ mplayer -ao pulse sound2.ogg 
AO: [pulse] Init failed: Connection refused
$ pactl list
Connection failure: Connection refused
pa_context_connect() failed: Connection refused

The only difference is - pulsemixer is just crashing instead of throwing an error. This I will fix. Other than that - not much I can do.

Now that aside, I couldn't figure out why it refuses or even who's fault is that (looks like systemd's tbh) but logging via machinectl seems to fix the socket activation:

root@localhost ~$ machinectl shell bote@
[bote@localhost ~]$ ps waux | grep pulse
bote      1083  0.0  0.1   4700  2280 pts/1    S+   13:27   0:00 grep pulse
[bote@localhost ~]$ ./pulsemixer -l
Sink:        ID: 0, Name: Built-in Audio Analog Stereo, Mute: 0, Channels: 2, Volumes: ['28%', '28%']
Source:      ID: 0, Name: Monitor of Built-in Audio Analog Stereo, Mute: 0, Channels: 2, Volumes: ['100%', '100%']
Source:      ID: 1, Name: Built-in Audio Analog Stereo, Mute: 0, Channels: 2, Volumes: ['67%', '67%']

It adds a bunch of XDG environment variables, creates directories in /run/user/ and makes a new systemd --user instance running under your user (and as I get it handles the socket activation). So, basically, you have to either use the old pulseaudio autospawn, or fix systemd socket activation.


And now about that init_pair() problem. You are either using an old terminal emulator which doesn't support 256 colors, or have your $TERM variable unset/set to some wrong value.

$ echo $TERM
xterm-256color
$ infocmp | grep 'colors#'
colors#256, cols#80, it#8, lines#24, pairs#32767

But regardless, implying that all users have 256 colors in their terminals is a really bad idea and I will add support for low-colored terminals shortly.

Oh, I see.
Thanks for analysis.
As for the color, you are right. My $TERM is xterm and it works in gnome-terminal.

Both should be fixed now. Well, the problem with socket activation is kinda half-fixed, since I can't do much besides handling the segfault and adding an error message.

Thanks. The colours works.
As for the other issue, I don't know, but now it starts automatically after boot of system and pulseaudio --kill will (probably) kill it, but it is then immediately run again.