Summary: | Double close() in logind code (can e.g. cause infinite loops in worker thread) | ||
---|---|---|---|
Product: | PackageKit | Reporter: | Benjamin Berg <benjamin> |
Component: | core | Assignee: | Richard Hughes <richard> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | ||
Version: | unspecified | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | Patch to fix the double close |
Description
Benjamin Berg
2016-02-10 00:17:03 UTC
I just checked, if you compare the file with the strings from the input stream cache, then the cut of character is exactly 8kiB after the beginning of the cache. So getline() seems to have returned everything until the buffer was exhausted and nothing more could be read from the (closed) file descriptor. Now, how could a file descriptor be closed for no apparent reason? I straced the process and saw a spurious close after running an apt-get update (that actually downloaded some new stuff). Haven't been able to pinpoint the source of that close though and I only straced close calls … strace -p 14204 -e close strace: Process 14204 attached close(10) = 0 close(11) = 0 close(12) = 0 close(11) = 0 close(11) = 0 close(11) = 0 close(11) = 0 close(11) = 0 close(12) = 0 close(12) = 0 close(13) = 0 close(13) = 0 close(12) = 0 close(13) = -1 EBADF (Bad file descriptor) close(12) = 0 Though I guess this might be one of the other threads doing it. open("/dev/urandom", O_RDONLY) = 10 close(10) = 0 open("/var/lib/PackageKit/transactions.db", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = 10 eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK) = 11 close(11) = 0 open("/var/lib/PackageKit/transactions.db-journal", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = 11 open("/var/lib/PackageKit", O_RDONLY|O_CLOEXEC) = 12 close(12) = 0 close(11) = 0 eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK) = 11 close(11) = 0 open("/proc/520/cgroup", O_RDONLY|O_CLOEXEC) = 11 close(11) = 0 open("/proc/1/cgroup", O_RDONLY|O_CLOEXEC) = 11 close(11) = 0 eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK) = 12 close(12) = 0 close(13) = 0 open("/dev/urandom", O_RDONLY) = 12 close(12) = 0 open("/var/lib/PackageKit/transactions.db", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = 12 eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK) = 13 close(13) = 0 open("/var/lib/PackageKit/transactions.db-journal", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = 13 open("/var/lib/PackageKit", O_RDONLY|O_CLOEXEC) = 14 close(14) = 0 close(13) = 0 close(13) = -1 EBADF (Bad file descriptor) eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK) = 11 close(11) = 0 open("/proc/520/cgroup", O_RDONLY|O_CLOEXEC) = 11 close(11) = 0 open("/proc/1/cgroup", O_RDONLY|O_CLOEXEC) = 11 close(11) = 0 open("/var/lib/PackageKit/transactions.db-journal", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = 36 close(36) = 0 close(35) = 0 close(34) = 0 Not sure if this proves anything though. Created attachment 121658 [details] [review] Patch to fix the double close So, turns out the double close is from the logind interaction. This patch should fix the issue (and the patch seems to work fine here). Funnily enough, it does mean that the login_fd was always invalid before. Pushed to master, 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.