Subject: SVR4; SO_LINGER NEEDED !!! (Was Re: Help with truncated files.)

From: [email-masked] (Mark Powell)
Date: Tue, 21 Feb 1995 10:24 +0000 (GMT)

In article <[email-masked]>,  <[email-masked]> wrote:
>I need some help with truncated files... it seems that some of my users are
>complaining that their files are being truncated about 90% of the way through.
>This problem MAY be related to a 'number of sockets' warning I've been 
>receiving.
>Is there a limit on the number of users the system can inherently handle??
>I'm running off a dx-280 with 12 megs ram, and a limit of 16 users.

Running on SVR4 by any chance? Probably need SO_LINGER enabled on the socket
so that all data is supposed to be delivered. Otherwise, you may find the
kernel discards the last bit of data in an attempt to speed the close() on
the socket.
I recently posted SVR4 patches to the net to fix, amongst other things,
this very problem. Look for this code (around line 1662) in src/ftpd.c:

#if defined(M_UNIX) && !defined(_M_UNIX)  /* bug in old TCP/IP release */
    {
        struct linger li;
        li.l_onoff = 1;
        li.l_linger = 900;
        if (setsockopt(s, SOL_SOCKET, SO_LINGER,
          (char *)&li, sizeof(struct linger)) < 0) {
            syslog(LOG_WARNING, "setsockopt (SO_LINGER): %m");
            goto bad;
        }
    }
#endif

This enables SO_LINGER on the data socket. Change the #if line to:

#if defined(SVR4) || (defined(M_UNIX) && !defined(_M_UNIX))  /* bug in some TCP/IP releases */

and make sure SVR4 is defined in src/config.h.
If you're not using SVR4 then forgive my ramblings.

>Thanks!
-- 
Mark Powell - Network Technician - Room: C806
Computer Services Unit, University College Salford, Salford, UK.
Tel:	+44 161 745 3376		Fax:	+44 161 736 3596
Email:	[email-masked]	PGP key available
<A HREF="http://plato.ucsalf.ac.uk/~mark/">Home Page</A>