linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* epoll_wait - 35 minutes equals infinity?
@ 2010-10-18 14:31 Fredrik Arnerup
  2010-10-18 16:20 ` Davide Libenzi
  0 siblings, 1 reply; 2+ messages in thread
From: Fredrik Arnerup @ 2010-10-18 14:31 UTC (permalink / raw)
  To: 'Davide Libenzi', linux-fsdevel

Hi,

I was doing epoll_wait calls with timeout values of over an hour and I was
wondering why the call never returned. Then I read the code in
fs/eventpoll.c:

#define EP_MAX_MSTIMEO min(1000ULL * MAX_SCHEDULE_TIMEOUT / HZ, (LONG_MAX -
999ULL) / HZ)
...
jtimeout = (timeout < 0 || timeout >= EP_MAX_MSTIMEO) ?
		MAX_SCHEDULE_TIMEOUT : (timeout * HZ + 999) / 1000;

I.e., with LONG_MAX of 2^31-1 and HZ=1000, any timeouts larger than 35
minutes are treated the same as -1 ("infinity").
Although I'm using 2.6.24, the code doesn't seem to have changed in 2.6.35.
I'm apparently not the first to have this problem
(http://www.provos.org/index.php?/archives/36-Libevent-1.4.4-stable-released
.html).

I suppose it is too late to change the interface to return an error when
setting too high a timeout and too tricky to fix epoll_wait to accept all
positive ints as timeouts.
Still, shouldn't the man page mention that there is a maximum allowable
value to the timeout and that it depends on whether you have a 64- or 32-bit
machine and what the timer frequency is?

/Fredrik Arnerup


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: epoll_wait - 35 minutes equals infinity?
  2010-10-18 14:31 epoll_wait - 35 minutes equals infinity? Fredrik Arnerup
@ 2010-10-18 16:20 ` Davide Libenzi
  0 siblings, 0 replies; 2+ messages in thread
From: Davide Libenzi @ 2010-10-18 16:20 UTC (permalink / raw)
  To: Fredrik Arnerup; +Cc: linux-fsdevel

On Mon, 18 Oct 2010, Fredrik Arnerup wrote:

> Hi,
> 
> I was doing epoll_wait calls with timeout values of over an hour and I was
> wondering why the call never returned. Then I read the code in
> fs/eventpoll.c:
> 
> #define EP_MAX_MSTIMEO min(1000ULL * MAX_SCHEDULE_TIMEOUT / HZ, (LONG_MAX -
> 999ULL) / HZ)
> ...
> jtimeout = (timeout < 0 || timeout >= EP_MAX_MSTIMEO) ?
> 		MAX_SCHEDULE_TIMEOUT : (timeout * HZ + 999) / 1000;
> 
> I.e., with LONG_MAX of 2^31-1 and HZ=1000, any timeouts larger than 35
> minutes are treated the same as -1 ("infinity").
> Although I'm using 2.6.24, the code doesn't seem to have changed in 2.6.35.
> I'm apparently not the first to have this problem
> (http://www.provos.org/index.php?/archives/36-Libevent-1.4.4-stable-released
> .html).
> 
> I suppose it is too late to change the interface to return an error when
> setting too high a timeout and too tricky to fix epoll_wait to accept all
> positive ints as timeouts.
> Still, shouldn't the man page mention that there is a maximum allowable
> value to the timeout and that it depends on whether you have a 64- or 32-bit
> machine and what the timer frequency is?

This is already queued somewhere for fixing:

http://lkml.org/lkml/2010/8/8/144



- Davide



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-18 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-18 14:31 epoll_wait - 35 minutes equals infinity? Fredrik Arnerup
2010-10-18 16:20 ` Davide Libenzi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).