- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re-using a port # when the previous connection is ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2002 12:39 PM
03-22-2002 12:39 PM
Re-using a port # when the previous connection is in TIME_WAIT
Here is what the process does:
- gets a port # (e.g. 646)
- binds to the port (no addr in use error)
- calls connect. This request succeeds and the connection is established. The connection is to another process on the local system via inetd.
- close connection
- connecton goes into TIME_WAIT as shown by the netstat -a cmd
tcp 0 0 blaze.bpxx blaze.646 TIME_WAIT
- ....
- the above sequence is repeated. This time if the same port is used i.e. 646 and the previous connection is in TIME_WAIT, the connect hangs and times out after a minute or so. The errno is 238 (ETIMEDOUT).
During this time the netstat -a shows
tcp 0 0 blaze.bpxx blaze.646 TIME_WAIT
tcp 0 1 blaze.646 blaze.bpxx SYN_SENT
- if we retry connect w/ a diff port #, the connect succeeds.
- if the connect is issued for port # 646 (e.g.) and there is no previous connection for port# 646 in TIME_WAIT, the connect succeeds.
We had started inted w/ -l option. The logs msgs in syslog did not show any connect request implying that the connect that timed out never made it to inetd.
I think there is a problem in the transport layer in dealing w/ a new connection w/ the same source and destination address as a previous connection in TIME_WAIT.
This is a solid failure. We are running HP_UX B.11.00 on 9000/800 machine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2002 02:46 PM
03-22-2002 02:46 PM
Re: Re-using a port # when the previous connection is in TIME_WAIT
If this is your code then you may want to look at:
http://www.softlab.ntua.gr/facilities/documentation/unix/unix-socket-faq/unix-socket-faq-4.html#ss4.1 and also the preceding pages.
Especially the section on SO_REUSEADDR.
Ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2002 03:36 AM
03-25-2002 03:36 AM
Re: Re-using a port # when the previous connection is in TIME_WAIT
For the client code calling connect(), its normal not to fix the port number with a call to bind(), but to allow the OS to select a random unused port for the client side of the connection. Obviously the servers port is fixed and specified in the connect call.
SO_REUSEADDR won't work in your case - in fact it looks like you're already using it otherwise bind() would have failed with address already in use. Usually this is only used in server code when setting up a listen socket.
You're going to have to re-think your strategy here, because this is the way TCP was designed. Hope this makes sense.
Regards,
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2002 05:47 AM
03-25-2002 05:47 AM
Re: Re-using a port # when the previous connection is in TIME_WAIT
My understanding was that since the SO_REUSEADDR is not specified, the bind call must prevent the process from binding to a port that it thinks is still in TIME_WAIT.
But if the bind succeeds the connect should also work.
Note that on HP the TIME WAIT INTERVAL is 60 secs. Whereas on SUN it is 4 min and we do not have the same problem on SUN inspite of he larger TIME WAIT INTERVAL.
The correct behaviour would be to not allow the bind or be able handle the connect.
The fact that the new connection is in SYN_SENT means that an attempt was made to initiate the connection by the sender. But the receiving end discarded it silently. It has been a while since I worked on the transport layer so I don't have any specifics. But I think something is not woring correctly. If we had seen this problem on all platforms I would believe it. But the same code runs fine on all other platforms (SUN, LINUX, AIX). We see this problem only on HP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 02:05 AM
03-26-2002 02:05 AM
Re: Re-using a port # when the previous connection is in TIME_WAIT
"If s is a SOCK_STREAM socket that is bound to the same local address as another SOCK_STREAM socket, connect() returns [EADDRINUSE] if addr is the same as the peer address of that other socket. This situation can only happen if the SO_REUSEADDR option has been set on s, which is an AF_INET socket (see getsockopt(2) )."
Before I confuse myself any further, I suggest you get the latest ARPA transport patch, lan products patch and your appropriate lan driver patch installed, then log a call with HP preferably with a simple test case to demonstrate the problem.
Out of interest what is the behaviour on other OS's? Does the bind() fail?
Regards,
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 05:28 AM
03-26-2002 05:28 AM
Re: Re-using a port # when the previous connection is in TIME_WAIT
I would think that the new connect request (SYN) should initiate a new connection since the sequence number is outside the range of sequence numbers for the previous connection that is in TIME_WAIT. A packet that has the same source and destination address but a sequence # less than or equal to the sequence number for the connection in TIME_WAIT can be regarded as a duplicate.
I'm not sure we have all the patches installed. But can look into it. Could you point us to the patches of interest?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 07:30 AM
03-26-2002 07:30 AM
Re: Re-using a port # when the previous connection is in TIME_WAIT
In particular, this patch contains the following fix:
"Symptom:
Applications that quickly reconnect to the same remote
port (e.g. remsh) can experience 2-second delays in
connection establishment.
Defect Description:
connect() takes 2+ seconds due to SYN retransmits
to a connection waiting to close in time_wait
Before a simple check was done to see if the new
starting sequence number were greater than the last
received sequence number of a connection in time wait.
This failed quite often when randomized sequence
numbers are used because often a valid new sequence
number would still test less than the previous
sequence number.
Resolution:
The fix is to save the starting sequence number of
a connection and test that the new sequence number
is not the same when connecting to a server in time
wait. All other inflight data can be rejected
because the client packet will be out of the exact
range of the servers sequence space, that is, its
ack will not match the server's sequence range."
This sounds like it may help.
There are a couple of dependencies listed with this patch, which in turn have other dependences, so make sure you install all the necessary patches at once.
If you're not sure use the custom patch manager on the ITRC site.
Regards,
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 07:52 AM
03-26-2002 07:52 AM
Re: Re-using a port # when the previous connection is in TIME_WAIT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2002 07:31 AM
03-28-2002 07:31 AM
Re: Re-using a port # when the previous connection is in TIME_WAIT
The patch # PHNE_22397 fixes the problem.