Bug 31790 - Retry on EIO on opening /dev/console
Summary: Retry on EIO on opening /dev/console
Status: NEW
Alias: None
Product: ConsoleKit
Classification: Unclassified
Component: Daemon (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: william.jon.mccann
QA Contact:
Depends on:
Reported: 2010-11-20 09:01 UTC by Martin Pitt
Modified: 2011-05-02 17:21 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

git formatted patch (1.94 KB, patch)
2010-11-20 09:04 UTC, Martin Pitt
Details | Splinter Review

Description Martin Pitt 2010-11-20 09:01:58 UTC
As reported in https://launchpad.net/bugs/544139, ConsoleKit sometimes fails to track the active VT. This particular case was tracked down to a race condition that happens if you try to open /dev/console while the current TTY is currently being closed. This yields an -EIO error, in which case CK should just try again.

For a more detailled summary of the problem from a kernel perspective, please see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/554172/comments/245 .

We have carried this patch for some months now and also backported it to previous stable releases. It was confirmed to fix the problem and we didn't get any negative feedback about it.
Comment 1 Martin Pitt 2010-11-20 09:04:40 UTC
Created attachment 40437 [details] [review]
git formatted patch

Patch by Colin Watson.
Comment 2 Lennart Poettering 2011-02-16 15:47:05 UTC
Grrr, sleep loops are evil. I wonder if we should just ignore this bug until the BKL is gone. Seems the issue is gone on .38 anyway.
Comment 3 Lennart Poettering 2011-02-18 05:05:53 UTC
Hmm, so I have discussed this with some folks, and it seems we do need something like this as the kernel will not help us here.

However, I don't think the patch is acceptable: there are other reasons why EIO might be returned. Since we cannot distuingish the error causes we need at least a safe way out. My suggestion would be to retry opening 20 times and then give up. In systemd I have settled to use 20 times with 50ms in between, totalling to 1s in total.

Could you please update the patch? I'll then merge it.
Comment 4 Lennart Poettering 2011-05-02 17:21:09 UTC
OK, I merged the patch now nonetheless. We should get fixed this properly one day (i.e. only retry a max number), so leaving this bug open.

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.