Review Request 129984: Prevent misdetection of EOF on Linux
Kurt Hindenburg
kurt.hindenburg at gmail.com
Wed Mar 8 02:04:22 UTC 2017
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/129984/#review102758
-----------------------------------------------------------
Since this changes kpty, it needs to get reviewed on https://phabricator.kde.org/ - can you please open a request there?
- Kurt Hindenburg
On March 4, 2017, 10:56 p.m., Peter Wu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/129984/
> -----------------------------------------------------------
>
> (Updated March 4, 2017, 10:56 p.m.)
>
>
> Review request for Konsole and Kurt Hindenburg.
>
>
> Bugs: 372991
> https://bugs.kde.org/show_bug.cgi?id=372991
>
>
> Repository: kpty
>
>
> Description
> -------
>
> On Linux, even if slave activity is detected on a master fd, FIONREAD
> can still return zero available bytes in the buffer. Previously this
> would prevent further signals from being emitted even if new IO arrived
> (since the readNotifier is disabled) which in its turn prevented the
> Konsole output from being updated.
>
> A race condition in the kernel is suspected, the first known broken
> kernel is v4.1.10-89-g5eb491ba5d06.
>
> BUG: 372991
>
>
> Diffs
> -----
>
> src/kptydevice.cpp 22233a505d32d988795839cb592098c38f7fab33
>
> Diff: https://git.reviewboard.kde.org/r/129984/diff/
>
>
> Testing
> -------
>
> Tested in conjunction with konsole v16.12.1-60-g151215a9 with this debug patch applied:
> ```
> diff --git a/src/kptydevice.cpp b/src/kptydevice.cpp
> index 92b443b..4dfcd02 100644
> --- a/src/kptydevice.cpp
> +++ b/src/kptydevice.cpp
> @@ -273,6 +273,7 @@ struct KPtyDevicePrivate : public KPtyPrivate {
> KRingBuffer writeBuffer;
> };
>
> +#include <cstdio>
> bool KPtyDevicePrivate::_k_canRead()
> {
> Q_Q(KPtyDevice);
> @@ -310,6 +311,9 @@ bool KPtyDevicePrivate::_k_canRead()
> // select() will trigger again anyway if an EOF condition was found, and
> // only then we will accept it.
> if (!available && !maybeEof) {
> + FILE *fp = fopen("/tmp/EOF", "a");
> + fprintf(fp, "Maybe EOF!?\n");
> + fclose(fp);
> maybeEof = true;
> return true;
> } else if (available) {
>
> ```
>
> Indeed, the /tmp/EOF file is being written and the Konsole output no longer "hangs".
>
> Closing a tab (via EOF in bash or closing the tab) somehow does not trigger this debug print, perhaps the watcher is disabled elsewhere. (This is an observation and not a problem.)
>
>
> Thanks,
>
> Peter Wu
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/konsole-devel/attachments/20170308/4e53c6bc/attachment.html>
More information about the konsole-devel
mailing list