This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Socket regressions
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: Jeff Sturm <jsturm at one-point dot com>
- Cc: java-patches at gcc dot gnu dot org, Nic Ferrier <nferrier at tf1 dot tapsellferrier dot co dot uk>
- Date: Tue, 19 Mar 2002 17:48:54 +1200
- Subject: Re: Socket regressions
- References: <Pine.LNX.4.10.10203182330560.5794-100000@mars.deadcafe.org>
Jeff Sturm wrote:
>I've had some trouble testing our application on the 3.1 branch
>(with i686-pc-linux-gnu):
>
>1) write() sometimes hangs in an infinite loop. It appears that we don't
>handle an error return from the system call properly. Moreover we ignore
>certain important errors like EBADF (why?).
>
I queried Nic Ferrier (who wrote the socket timeout code) about that
when he submitted the patch. He assured me that it was correct, but
ignoring them does seem odd to me. Its been a while since I did much
with socket stuff, but surely it is supposed to throw if you try to
write to a closed or unconnected socket?
>3) available() tends to return 1 for sockets even when there's nothing to
>be read. Is it important to also check FD_ISSET on the read descriptor?
>Or can we trust the return value of select()?
>
The select call looks ok to me, I dont think FD_ISSET should be needed
because we only just pu the fd in the set. Is it the select call which
is setting the result to 1, or the FIONREAD ioctl above it?
>Below is a patch for 1). I'm unsure whether 2) is a real problem, but 3)
>seems to break existing code like Apache JServ (the code could be more
>robust, but it is widely used nonetheless).
>
>2002-03-18 Jeff Sturm <jsturm@one-point.com>
>
> * java/nat/natPlainSocketImpl.cc (write): Abort loop on error.
>
OK for mainline and branch, as an interim fix. I think some testing is
required to figure out what is really correct.
regards
Bryce.