From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757317AbcIUP7U convert rfc822-to-8bit (ORCPT ); Wed, 21 Sep 2016 11:59:20 -0400 Received: from smtp-out6.electric.net ([192.162.217.194]:60530 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752502AbcIUP7T (ORCPT ); Wed, 21 Sep 2016 11:59:19 -0400 From: David Laight To: "'Neil Horman'" , Sun Paul CC: "linux-sctp@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: Address already in use problem Thread-Topic: Address already in use problem Thread-Index: AQHSFA3yekZmYOGWW0evpZ7C6RZC1KCEBM8AgAAS8IA= Date: Wed, 21 Sep 2016 15:56:41 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB010623F@AcuExch.aculab.com> References: <20160921154304.GB13620@hmsreliant.think-freely.org> In-Reply-To: <20160921154304.GB13620@hmsreliant.think-freely.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuExch.aculab.com X-TLS: TLSv1:AES128-SHA:128 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Neil Horman > Sent: 21 September 2016 16:43 > On Wed, Sep 21, 2016 at 09:44:30PM +0800, Sun Paul wrote: > > Hi > > > > we have an SCTP application running in JAVA. and we found that there > > is a problem when we as a client trying to connect to a remote IP > > address. > > > > If the remote IP address is not accessible, our application will keep > > retrying to connect using a self-defined local port address, says > > 51001, > > > > We found that after sometimes, says 2 hrs, this port 51001 is never > > able to bind to us again. even we tried to restart the application. > > > Sounds like you have another application that inadvertently bound to that port. > Its not a privlidged port, nor is it well known, so it seems plausible that > another application would eventually bind to it. Thats not a bug, just the way > ip works. > > run netstat -anp | grep 51001 > > And see what application is holding the port. Not much chance of a distro having a netstat that gives sctp info. You might find something in /proc/net/sctp. 3.18 contains a fix for a problem with shutdown() being called after the remote sends an INIT to restart an active connection when there is unacked data. If that happens the socket isn't released ever. A workaround is to use SO_LINGER to get the connection aborted. David