[Date Prev][Date Next] [Chronological] [Thread] [Top]

tcp_close and SHUT_RDWR, too many opened sockets



hello,

SHUT_RDWR is defined and non null in /usr/include/sys/socket.h:

enum
{
  SHUT_RD = 0,		/* No more receptions.  */
#define SHUT_RD		SHUT_RD
  SHUT_WR,		/* No more transmissions.  */
#define SHUT_WR		SHUT_WR
  SHUT_RDWR		/* No more receptions or transmissions.  */
#define SHUT_RDWR	SHUT_RDWR
};

but in openldap-2.15/include/ac/socket.h you have:
#else
#	define tcp_read( s, buf, len)	read( s, buf, len )
#	define tcp_write( s, buf, len)	write( s, buf, len )

#	if SHUT_RDWR
#		define tcp_close( s )	(shutdown( s, SHUT_RDWR ), close( s ))
#else
#		define tcp_close( s )		close( s )
#endif

and it's like SHUT_DOWN was null!! (I can't understand why), so I'm obliged to modify openldap-2.15/include/ac/socket.h :
I put
# ifdef SHUT_RDWR
instead of
# if SHUT_RDWR
and so slapd make a shutdown() before calling close().


I do that because we got many and many connection in FIN_WAIT or CLOSE_WAIT state. Now it's a little better. But maby have you some idea to reduce the number of opened socket or how to close them immediately when you close a connection in slapd.
the problem arrives for us because of the system limit for file descriptor.


thank you for your help
best regards,

Lise DIDILLON