Bug 80867

Summary: Pulseaudio dies when using mmkbd-evdev and the input device is unplugged
Product: PulseAudio Reporter: Stelios Bounanos <sb-fdbugs>
Component: modulesAssignee: pulseaudio-bugs
Status: RESOLVED FIXED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 75721    

Description Stelios Bounanos 2014-07-03 18:34:44 UTC
With the mmkbd-evdev module enabled e.g. like so in ~/.pulse/default:

  load-module module-mmkbd-evdev device=/dev/input/by-id/usb-0430_Sun_USB_Keyboard-event-kbd

pulseaudio crashes when that keyboard is unplugged.  The following messages
are logged to syslog:

  Jul 3 19:21:17 hostname pulseaudio[11515]: [pulseaudio] module-mmkbd-evdev.c:
  Lost connection to evdev device.
  Jul 3 19:21:17 hostname pulseaudio[11515]: [pulseaudio] module-mmkbd-evdev.c:
  Assertion 'pa_close(u->fd) == 0' failed at modules/module-mmkbd-evdev.c:260,
  function module_mmkbd_evdev_LTX_pa__done(). Aborting.

I would guess that the fd has already been closed and close(2) returns EBADF
to pa_close().
Comment 1 Stelios Bounanos 2014-07-03 19:05:16 UTC
I should have mentioned that this is pulseaudio 5.0 on an up to date
Debian/unstable system running kernel 3.14.
Comment 2 Tanu Kaskinen 2014-07-07 12:14:02 UTC
6.0 blocker. Shouldn't be hard to fix...
Comment 3 David Henningsson 2014-09-02 09:26:32 UTC
(In reply to comment #2)
> 6.0 blocker. Shouldn't be hard to fix...

I had a look but didn't find anything obvious. My guess is that the kernel reports something strange on close, such as -ENODEV or something, instead of just closing it. Stelios, can you check what error we get on pa_close?
Comment 4 Stelios Bounanos 2014-09-11 14:18:48 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > 6.0 blocker. Shouldn't be hard to fix...
> 
> I had a look but didn't find anything obvious. My guess is that the kernel
> reports something strange on close, such as -ENODEV or something, instead of
> just closing it. Stelios, can you check what error we get on pa_close?

Yes, indeed, after pa_close returns -1, errno is set to ENODEV.
Comment 5 David Henningsson 2014-09-12 08:11:35 UTC
Thanks, patch posted here:

http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-September/021617.html
Comment 6 David Henningsson 2014-10-03 12:28:45 UTC
I pushed 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.