SUMMARY: problem: tcp_keepalive_interval

From: Oscar Goldes (ogolde@impsat1.com.ar)
Date: Fri Jan 30 1998 - 07:03:08 CST


*****************
Original question

Working on Solaris 2.5 sparc.

I am trying to make my aplications aware of some communication problems
by using the SO_KEEPALIVE socket option, set with the setsockopt() system
call.

I have to decrease the keepalive interval, the default of which I believe
is 2 hours.

Using ndd /dev/tcp/ tcp_keepalive_interval, I get the value of 7200000,
which seems to be 2 hours if the unit is one millisecond. To test, I set
the interval to several values, and found that the minimum seems to be 10
seconds (ndd -set /dev/tcp tcp_keepalive_interval 10000).

However, my apps seem to just ignore the keepalive option; they do never
get the SIGPIPE they are supposed to receive, even if I unplug the network
cable while a tcp connection with other machine is open, no matter how long
I wait.

I have browsed reference manuals, answerbooks, FAQs, the list search
engine, but have not been able to found any help. The usage of SO_KEEPALIVE
does not seem to be very deeply documented anywhere.

Could somebody point me towards some document on the subject? And, by the
way, does SO_KEEPALIVE work at all on Solaris 2.5?? Or is some patch needed?

*****************
Thanks to:
Casper Dik
Todd Boss
--------------
>From Tod Boss:
...
tcp_keepalive_interval is a vital tuning requirement when working with
any type of Sybase application. I can assure you it works w/ Sybase SQL
servers and Sybase open-client API applications on PC desktops (the typical
Sybase client-server model)
.....
go to the Sybase faq: http://reality.sgi.com/pablo/Sybase_FAQ and
do a search on keepalive for more info (though most of the useful info
about the parameter is in Q 10.2.2 in the section called keepalive Redux.
(coincidentally, i wrote question 7.9).

.............
--------------
>From Casper Dik:

They're not supoosed to receive a SIGPIPE.

They will receive a EOF (read returns 0) when reading and they may receive
a SIGPIPE or error on write.

If they do not look at the FD they won't notice the disconnect.

------------

So my conclussions are:
1) It does work. However, the man page of setsockopt() is misleading, it
states:
".... SO_KEEPALIVE enables the periodic transmission of messages on a
connected socket. If the connected party fails to respond to these
messages, the connection is considered broken and the processes using the
socket are notified using a SIGPIPE signal..."
You only get the SIGPIPE if you try to write to the socket, and if you
read, you receive a 0. If you are waiting on a select() on the socket, you
will not get any notice, and select() wont awaken you (at least if you are
select()ing for reading).

2) The default interval is 2 hours and can be modified with ndd. These
modification does not persist after reboot.

I will appreciate any further info on KEEPALIVEs..
-- Oscar Goldes
-- Orden Argentina SA



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:30 CDT