Re: Error Message from my proxy server

Marius Tomaschewski <[email protected]> Fri, 26 Jul 2002 13:23:51 +0200
Newsgroups gmane.linux.suse.proxy-suite
Organization SuSE Labs, Product Developement
Message-ID <[email protected]>
On Thu, Jul 25, 2002 at 05:07:07PM -0400, Ruiyuan Jiang wrote:
> Hi, all

Hi!

> I found a lot of same messages in my new proxy server:
> 
> ftp-child [1097] <07/25-10:06:07> TECH-ERR can't get num of bytes: Cli-Ctrl
> 0=156.146.109.250
  ^
  |

Are you running in inetd mode (not a problem - just a question)?

> Where the IP address is the client connects to the proxy server to ftp in
> and out of Internet through this ftp proxy server. The message repeats every
> minute in the log file while the proxy server seems working fine. We run the
> proxy server on Sun Blade 100, Solaris 9 and TCP Wrapper and chroot
> functions of proxy server are enabled. Does anyone know whether I can ignore
> this message or something is wrong? Thanks in advance.

This is a common problem on Solaris, that Solaris powers up select
(=data avaliable to read) but returns "no data" via the I_NREAD
ioctl (see socket_ll_read in com-socket.c).

The message you've got means, the ioctl is failed at all and the
proxy goes back into the select loop...

Set LogLevel DBG in your config, please and take a look if you can
also see some "zero bytes to read reported" as well...

As I see, there is also a bug in the code (static retries variable
is shared for all sockets and may cause false errors).

Please apply the patch from attachement (if it works, I'll put it
on ftp.suse.com as well...).

Kind regards,
 Marius Tomaschewski <[email protected]>
--
 SuSE Linux AG, NÃŒrnberg - SuSE Labs, Product Developement
 PGP public key available:   http://www.suse.de/~mt/mt.pgp
 Fprint:  EA 1F 92 75 1A F9 82 07  A1 28 DE 7A 32 E8 97 18

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
proxy-suite-1.9.recv_retry.dif (text/plain, 1.6 KB)
--- proxy-suite-1.9/common/com-socket.c
+++ proxy-suite-1.9/common/com-socket.c	2002/07/26 11:20:45
@@ -414,6 +414,7 @@
 
 	hls->kill = 0;
 	hls->ernr = 0;
+	hls->rerr = 0;
 	hls->flag = 0;
 	hls->more = 0;
 	hls->ctyp = "HLS-TYPE";
@@ -994,7 +995,6 @@
 
 static void socket_ll_read(HLS *hls)
 {
-	static int retries = 0;
 	int len, cnt, nsock;
 	BUF *buf, *tmp;
 	struct sockaddr_in saddr;
@@ -1045,7 +1045,9 @@
 	if( (cnt=ioctl(hls->sock, FIONREAD, &len)) < 0) {
 		hls->ernr = errno;
 		syslog_error("can't get num of bytes: %s %d=%s",
-					hls->ctyp, hls->sock, hls->peer);
+			     hls->ctyp, hls->sock, hls->peer);
+		close(hls->sock);
+		hls->sock = -1;
 		return;
 	}
 #if defined(COMPILE_DEBUG)
@@ -1065,7 +1067,7 @@
 		** caused transfer aborts on bigger files.
 		** wait and retry before we assume this is a EOF.
 		*/
-		if((0 == cnt) && (++retries < MAX_RETRIES)) {
+		if((0 == cnt) && (++hls->rerr < MAX_RETRIES)) {
 			syslog_write(T_DBG,
 			      "zero bytes to read reported: %s %d=%s",
 			      hls->ctyp, hls->sock, hls->peer);
@@ -1089,7 +1091,7 @@
 	/*
 	** else reset retry counter on success
 	*/
-	retries = 0;
+	hls->rerr = 0;
 
 	/*
 	** Limit the receive buffer sizes
--- proxy-suite-1.9/common/com-socket.h
+++ proxy-suite-1.9/common/com-socket.h	2002/07/26 10:50:48
@@ -88,6 +88,7 @@
 	int       sock;		/* The corresponding socket	*/
 	int       kill;		/* 1=kill socket after send	*/
 	int       ernr;		/* socket i/o error number	*/
+	int       rerr;		/* recv i/o error counter	*/
 	int       flag;		/* Flag for send() (e.g. OOB)	*/
 	int       more;		/* 1=read more to complete line	*/
 	u_int32_t addr;		/* Peer's address (host order)	*/