freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: SMASKELL AT UP.COM
- To: freetds AT franklin.oit.unc.edu
- Subject: Bug in read.c
- Date: Thu, 23 May 2002 09:04:10 -0500
There appears to be an error in read.c that bit me the other day. I got a
call from the Unix police saying that my processes were eating all of the
CPU. I connected to them with gdb and found that they appeared to be stuck
in a read() loop. There had been a network outage and my programs'
connections to their db servers had been dropped, apparently precipitating
the problem. Looking at the source for goodread() in read.c it appears
that there is no allowance made for the read() call returning 0. If a
socket read, blocking or not, returns 0 it is an indication that the socket
connection has been closed/broken. This was the case in my situation.
Since read did not block and returned 0 immediately, the function looped
continuously.
It looks like you could just change line 77 of read.c from:
if (len < 0) {
to:
if (len <= 0) {
That would catch read() returning 0 and assume the socket was broken.
Opinions?
Thanks
Scott Maskell
-
Bug in read.c,
SMASKELL, 05/23/2002
- <Possible follow-up(s)>
- Re: Bug in read.c, martin dempsey, 05/23/2002
- Re: Bug in read.c, Jon Pounder, 05/23/2002
- Re: Bug in read.c, SMASKELL, 05/23/2002
- RE: Bug in read.c, Matt Kynaston, 05/27/2002
- Re: Bug in read.c, ZIGLIO Frediano, 05/27/2002
Archive powered by MHonArc 2.6.24.