Bug 88802 - Unplugging usb serial devices while probing leaks filedescriptors
Summary: Unplugging usb serial devices while probing leaks filedescriptors
Status: RESOLVED INVALID
Alias: None
Product: ModemManager
Classification: Unclassified
Component: general (show other bugs)
Version: 1.4
Hardware: Other All
: medium normal
Assignee: ModemManager bug user
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-26 15:28 UTC by Simon Budig
Modified: 2015-01-26 22:07 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Simon Budig 2015-01-26 15:28:54 UTC
When an USB serial dongle gets unplugged while modemmanager is probing it, the probing process fails to detect this situation and keeps the now useless filedescriptor open forever.

By rapidly un- and replugging a device I ended up in this situation:

$ ls /proc/<mm-pid>/fds/
lr-x------ 1 root root 64 Jan 26 16:04 0 -> /dev/null
lrwx------ 1 root root 64 Jan 26 16:04 1 -> socket:[3713709]
lrwx------ 1 root root 64 Jan 26 16:04 10 -> /dev/ttyACM1 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 11 -> /dev/ttyACM2 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 12 -> /dev/ttyACM3 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 13 -> /dev/ttyACM4 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 14 -> /dev/ttyACM5 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 15 -> /dev/ttyACM6 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 16 -> /dev/ttyACM7 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 17 -> /dev/ttyACM8 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 18 -> /dev/ttyACM9 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 19 -> /dev/ttyACM10 (deleted)
l-wx------ 1 root root 64 Jan 26 16:04 2 -> /dev/null
lrwx------ 1 root root 64 Jan 26 16:04 20 -> /dev/ttyACM11 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 21 -> /dev/ttyACM12 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 22 -> /dev/ttyACM13 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 23 -> /dev/ttyACM14 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 24 -> /dev/ttyACM15 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 25 -> /dev/ttyACM16 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 26 -> /dev/ttyACM17 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 27 -> /dev/ttyACM18 (deleted)
lrwx------ 1 root root 64 Jan 26 16:04 28 -> /dev/ttyACM19


So not only this leaks the filedescriptors, it also prevents the kernel from properly cleaning up the devices, resulting in weird enumeration of the usb serial dongle.

Seems the error checking in the probing process needs to be improved.
Comment 1 Aleksander Morgado 2015-01-26 17:57:33 UTC
Is this with 1.4.0 or with 1.4.2?

1.4.0 had a bug in the ports closing, which was fixed for 1.4.2:

commit 41b7e7b048e67a0b329c820c81beccf42bf0957e
Author: Dan Williams <dcbw@redhat.com>
Date:   Tue Oct 7 15:53:53 2014 -0500

    port-serial: fix forced closing after b28230411
    
    b28230411 moved up the self->priv->forced_close = TRUE, which
    caused mm_port_serial_close() to just return without actually
    closing the port and cleaning up.
    
    Also, cancel the reopen separately from closing the port since
    the two operations are actually independent of each other.
Comment 2 Simon Budig 2015-01-26 22:07:48 UTC
This is with 1.4.0 as of debian unstable.

I'll mark it as resolved invalid for now, hopefully I'll remember to check that again in the future when the version in debian is more up to date.

thanks.


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.