Bug 96741

Summary: asyncmsgq.c: Assertion 'a->asyncq = pa_asyncq_new(size)' failed at pulsecore/asyncmsgq.c:66, function pa_asyncmsgq_new(). Aborting.
Product: PulseAudio Reporter: Marcin Lewandowski <marcin>
Component: coreAssignee: pulseaudio-bugs
Status: RESOLVED FIXED QA Contact: pulseaudio-bugs
Severity: critical    
Priority: medium CC: lennart
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 96750    
Attachments: Log error if we hit file desciptors limit

Description Marcin Lewandowski 2016-06-30 08:23:00 UTC
I have compiled PA 9.0 from sources on ubuntu 16.04. I use only required dependencies.

asyncmsgq.c: Assertion 'a->asyncq = pa_asyncq_new(size)' failed at pulsecore/asyncmsgq.c:66, function pa_asyncmsgq_new(). Aborting.

I use it as a regular user with the following config:

#!/usr/bin/pulseaudio -nF

.fail

load-module module-native-protocol-unix auth-group=app auth-cookie-enabled=false srbchannel=true

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink sink_name=null

### Honour intended role device property
load-module module-intended-roles

### Make some devices default
set-default-sink null
set-default-source null.monitor


I spawn it using systemd:

[Unit]
Description=App PulseAudio

[Service]
User=app
Group=app
WorkingDirectory=/home/app
ExecStart=/opt/myapp-1.0/bin/pulseaudio --high-priority=1 --realtime=1 --disallow-exit=1 --exit-idle-time=-1 --log-target=syslog --no-cpu-limit -F /etc/pulse/app.pa -n
Environment="LD_LIBRARY_PATH=/opt/myapp-1.0/lib"
OOMScoreAdjust=-100
KillMode=process
Restart=always
RestartSec=5s
TimeoutSec=30s
LimitMEMLOCK=134217728
LimitNICE=31
LimitRTPRIO=-99
LimitNOFILE=64000
LimitNPROC=64000
LimitCPU=infinity
IOSchedulingClass=realtime
IOSchedulingPriority=1

[Install]
WantedBy=multi-user.target
Alias=myapp-pulseaudio.service

It happens quite frequently, every a few minutes.

There are loads of free memory and other resources on the server.
Comment 1 Marcin Lewandowski 2016-06-30 09:33:27 UTC
PA 8.0 does the same.
Comment 2 Marcin Lewandowski 2016-06-30 10:26:48 UTC
I have found out that once this happens, the code flow is the following:

* pa_asyncmsgq_new calls

* pa_asyncq_new

  here it fails on 

  !(l->write_fdsem = pa_fdsem_new())

* pa_fdsem_new 

  here it fails on 

  pa_pipe_cloexec(f->fds) < 0

* pa_pipe_cloexec

  HAVE_PIPE2 is set

  if ((r = pipe2(pipefd, O_CLOEXEC)) >= 0) {
    pa_log("(r = pipe2(pipefd, O_CLOEXEC)) >= 0");
    goto finish;
  }

  has to return < 0 because it does not jump into finish

  but then

  if (errno != EINVAL && errno != ENOSYS) 

  matches, so it returns r, which is < 0.
Comment 3 Marcin Lewandowski 2016-06-30 10:38:53 UTC
Created attachment 124795 [details] [review]
Log error if we hit file desciptors limit
Comment 4 Marcin Lewandowski 2016-06-30 10:39:19 UTC
It seems that I just hit FD limit, but well, message is less than explanatory now, so I added some logging.
Comment 5 Tanu Kaskinen 2016-06-30 16:35:00 UTC
Crasher, marking as a 10.0 blocker.
Comment 6 Tanu Kaskinen 2016-09-10 15:03:10 UTC
Thanks for the logging patch. I applied it now.

I'll try to come up with a fix for the crash.
Comment 7 Tanu Kaskinen 2016-09-15 14:39:08 UTC
Here's a patch that will hopefully fix the crash: https://patchwork.freedesktop.org/patch/110227/
Comment 8 Tanu Kaskinen 2016-12-19 23:24:31 UTC
I committed the patch now.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.