bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Infinite polling loop


From: Bryan Christ
Subject: Re: Infinite polling loop
Date: Sun, 3 Jun 2018 10:21:44 -0500

Thomas,

I've tried setting the values ranging from 1 to 5000.  The poll() call still gets stuck in an infinite loop just with different timeout values.  I retested under Eterm with timeout() set to 15 so that I could see what was going on under the hood.  Unlike xfce4-terminal, with Eterm there are alternating poll() calls which tells me it's not stuck in a loop.

poll([{fd=5, events=POLLIN}], 1, 1)     = 1 ([{fd=5, revents=POLLNVAL}])
poll([{fd=0, events=POLLIN}], 1, 15)    = 0 (Timeout)
poll([{fd=5, events=POLLIN}], 1, 1)     = 1 ([{fd=5, revents=POLLNVAL}])
poll([{fd=0, events=POLLIN}], 1, 15)    = 0 (Timeout)
poll([{fd=5, events=POLLIN}], 1, 1)     = 1 ([{fd=5, revents=POLLNVAL}])
poll([{fd=0, events=POLLIN}], 1, 15)    = 0 (Timeout)
poll([{fd=5, events=POLLIN}], 1, 1)     = 1 ([{fd=5, revents=POLLNVAL}])
poll([{fd=0, events=POLLIN}], 1, 15)    = 0 (Timeout)
poll([{fd=5, events=POLLIN}], 1, 1)     = 1 ([{fd=5, revents=POLLNVAL}])
poll([{fd=0, events=POLLIN}], 1, 15)    = 0 (Timeout)
poll([{fd=5, events=POLLIN}], 1, 1)     = 1 ([{fd=5, revents=POLLNVAL}])
poll([{fd=0, events=POLLIN}], 1, 15)    = 0 (Timeout)
poll([{fd=5, events=POLLIN}], 1, 1)     = 1 ([{fd=5, revents=POLLNVAL}])


On Sat, Jun 2, 2018 at 7:42 PM, Thomas Dickey <address@hidden> wrote:
On Sat, Jun 02, 2018 at 11:10:38AM -0500, Bryan Christ wrote:
> Thomas, the observation was on another application... VWM (which uses
> libvterm).  I also observed this problem does not happen with Eterm or
> xterm.

The spinning is in libviper, where it attempts to read keys.
During libviper's initialization, it calls

        nodelay(SCREEN_WINDOW, TRUE);

which tells it to not wait if there's no data.  It then switches over
to the other protothread.

Changing that to a very small timeout (1 millisecond) gets rid of the
problem:

        wtimeout(SCREEN_WINDOW, 1);

You wouldn't notice the problem on the Linux console, because
viper_kmio_fetch checks for data from GPM (which doesn't return
immediately).

> On Sat, Jun 2, 2018, 9:00 AM Thomas Dickey <address@hidden> wrote:
>
> > On Fri, Jun 01, 2018 at 11:27:50PM -0500, Bryan Christ wrote:
> > > I recently encountered a bizarre problem with a polling loop on Xubuntu
> > > 18.04.  When I run my application on a standard tty, it runs fine.  When I
> > > run it in xfce4-terminal the screen is completely blank.  When I strace the
> > > application, it's running in an vigorous polling loop.  When I run the
> > > application on 16.04 there are no problems at all on a standard tty nor on
> > > xfce4-terminal.  On Xubuntu 18.04 ncurses = 6.1 (20180127).  I also get the
> > > exact same behavior when I try to run in rxvt.
> >
> > hmm - I compiled
> >         https://github.com/TragicWarrior/libvterm
> >
> > using Ubuntu 18.04 and don't see a problem (xfce4-terminal 0.8.7.3).
> > The vshell program works, and top shows a low load factor.

--
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net



--
Bryan
<><

reply via email to

[Prev in Thread] Current Thread [Next in Thread]