freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: ZIGLIO Frediano <Frediano.Ziglio AT omnitelvodafone.it>
- To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
- Subject: Re: Some (other) patches
- Date: Tue, 28 May 2002 10:11:55 +0200
>
> On Tue, 2002-05-28 at 00:33, ZIGLIO Frediano wrote:
> > 6 - for timeout you used select with 0 timeout looping and
> releasing cpu to
> > kernel at every kernel schedule. So you can waste a lot of
> cpu time. This
> > patch pass timeout to select so process is suspended until
> timeout, error or
> > signal (such as interrupt). Also remove some duplicated
> select and finish
> > code to check for EINTR error on select (this should be
> done on read/write
> > too)
>
> Since I was the last person to fiddle with this bit of code
> ... Frediano
> has improved on what I had done. Well done.
tnks
>
> Brian, I've reviewed this patch (#6) and it looks okay.
>
> Frediano, can you predict what will happen if a connection is
> made while
> the network cable is unplugged, but before the timeout occurs the
> network cable is restored, and then the connection is refused?
Machine send a syn packet, packet is lost, if kernel can detect that syn
packet cannot be send select return < 0 without waiting all timeout, if
kernel cannot detect packet lost this code wait for timeout seconds and then
give timeout.
>
> Looking at the code as you have written it, it makes me think that the
> connection refused won't be noticed, and a timeout will occur ...
> because the select is only waiting for writeability and the result of
> the connect is not checked.
>
> Shouldn't it also call getsockopt() using SOL_SOCKET and SO_ERROR, to
> get the deferred errno return from connect()?
>
I know, but from tds_connect you cannot determinate reason of connection
failure (server not found, connection timeout or other).
> Lastly, in write.c, there is a check for writeability using
> select, but
> no code to handle the timeout.
>
On timeout code fall through, socket is not-blocking, write return < 0
(error) and connection is closed... (this patch do not change previous
behaviour). What's a better solution? Watching code more deepeer you cannot
return from tds_write_packet writing only a part of buffer (buffer is
rewritted suddently, see also patch #5). A more clean and high-level
solution is cancel query automatically... but this not solve timeout sending
packet (you have to change some other code).
freddy77
-
Some (other) patches,
ZIGLIO Frediano, 05/27/2002
- <Possible follow-up(s)>
- Re: Some (other) patches, James Cameron, 05/27/2002
- Re: Some (other) patches, ZIGLIO Frediano, 05/28/2002
Archive powered by MHonArc 2.6.24.