Re: Lynx spinning. Kernel problem?

Gevan Dutton (shanos@es.co.nz)
Mon, 25 Nov 1996 18:54:28 +1300 (NZDT)


On Sun, 24 Nov 1996, David Schwartz wrote:

> I've found that lynx sometimes spins out of control chewing
> massive system time. If I watch it spin with strace, I see the following:
> (IP address replaced with a.b.c.d).

[ugly strace snipped]

> So what I imagine is happening is lynx (2.3 BETA) calls 'connect'
> with a non-blocking socket, and connect returns immediately. Then lynx
> selects with a zero timeout, the select returns, and lynx calls connect
> again. But why would lynx do anything so stupid?
>
> Does anyone know if this is because lynx is confused by Linux's
> return value (EALREADY) or because lynx is really brain damaged or
> because of a bug in lynx, or what?

I'm guessing that lynx is reusing a struct timeval in the loop, which
starts with a sensible timeout in it. According to the select manpage,
linux will modify the timeval to reflect the amount of time not slept;
"most other implementations" do not do this. So if the select waits for the
entire time, the passed struct timeval is modified to 0, 0. Next time
round the loop, this value is used. I can't confirm this, because I
don't have the source to 2.3, however I'd suggest upgrading to 2.6, which
might fix the problem - at least, the source for 2.6 doesn't seem to have
this problem.

Of course, it could be a much less subtle bug.