negative timeout can be set up by setsockopt system call
Quoted 9 lines · Ram Gupta
On 11/4/05, Nish Aravamudan <[email protected]>
Quoted 5 lines
In Ram's specific case, I think, the call path is
sys_setsockopt()->sock_setsockopt()->sock_set_timeout, which has a definition of:static int sock_set_timeout(long
*timeo_p, char__user*optval, intoptlen)
Quoted 1 line
Quoted 1 line
Exactly right.
Ok.
Quoted 11 lines
Quoted 6 lines
Ram, what is the expected behavior of negative values in the timeval? And what are you seeing happen right now?
As of 2.6.14, looks like we convert any non-zero values into jiffies and store them in sk->sk_{rcv,snd}timeo...
I don't see any problem from the kernel side but the application
times out immediately causing certain failures as theschedule_timeoutreturns immediately in case of negative values. Shouldn't there be a check for negative values and return error to the application so that it can handle it.
I mean more along the lines of what does a man-page say the kernel should be doing if you request a negative timeout? More explicitly, what made you think negative timeouts should have a specific effect?
Quoted 1 line
Quoted 1 line
The man page is silent about the timeout behaviour in case of its being negative. I believe that negative timeout is a mistake on behalf of an application and hence should be treated as such (i.e should be notified accordingly)
When you say schedule_timeout() returns immediately, I assume your logs are filling up with "schedule_timeout: wrong timeout ..." ? (You may need to bump your loglevel). If not, then schedule_timeout() isn't getting a negative value.
Quoted 1 line
Quoted 1 line
Yes I am getting the "
schedule_timeout: wrong timeout ..." messages so I am sure the timeout has negative value.
Thanks,
Nish
regards
Ram Gupta
Quoted 26 lines · Ram Gupta
Quoted 9 lines · Ram Gupta
On 11/4/05, Nish Aravamudan <[email protected]>
Quoted 5 lines
In Ram's specific case, I think, the call path is
sys_setsockopt()->sock_setsockopt()->sock_set_timeout, which has a definition of:static int sock_set_timeout(long
*timeo_p, char__user*optval, intoptlen)
Quoted 1 line
Quoted 1 line
Exactly right.
Ok.
Quoted 11 lines
Quoted 6 lines
Ram, what is the expected behavior of negative values in the timeval? And what are you seeing happen right now?
As of 2.6.14, looks like we convert any non-zero values into jiffies and store them in sk->sk_{rcv,snd}timeo...
I don't see any problem from the kernel side but the application
times out immediately causing certain failures as theschedule_timeoutreturns immediately in case of negative values. Shouldn't there be a check for negative values and return error to the application so that it can handle it.
Quoted 8 lines
I mean more along the lines of what does a man-page say the kernel should be doing if you request a negative timeout? More explicitly, what made you think negative timeouts should have a specific effect?
Quoted 4 lines
The man page is silent about the timeout behaviour in case of its being negative. I believe that negative timeout is a mistake on behalf of an application and hence should be treated as such (i.e should be notified accordingly)
Well, the problem is that there is no defined behavior for specifying a negative timeout (unlike poll(), for instance). So I'm not sure what the best approach is (beyond complaining to the application developers that their app is busted).
Quoted 7 lines
When you say
schedule_timeout()returns immediately, I assume your logs are filling up with "schedule_timeout: wrong timeout ..." ? (You may need to bump your loglevel). If not, thenschedule_timeout()isn't getting a negative value.Quoted 1 line
Quoted 1 line
Yes I am getting the "
schedule_timeout: wrong timeout ..."messages so I am sure the timeout has negative value.
Ok, maybe bring this up with the networking folks, as they may have a better idea of what to do.
Thanks,
Nish