Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 3652 invoked from network); 5 Oct 2007 16:35:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Oct 2007 16:35:12 -0000 Received: (qmail 27527 invoked by uid 500); 5 Oct 2007 16:35:00 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 27496 invoked by uid 500); 5 Oct 2007 16:35:00 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 27487 invoked by uid 99); 5 Oct 2007 16:35:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Oct 2007 09:35:00 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Oct 2007 16:35:11 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 95D9B71422C for ; Fri, 5 Oct 2007 09:34:50 -0700 (PDT) Message-ID: <4179545.1191602090603.JavaMail.jira@brutus> Date: Fri, 5 Oct 2007 09:34:50 -0700 (PDT) From: "Bryan Pendleton (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-3108) Iteratively creating and closing client connection yields java.net.BindException: Address already in use: connect after many connections In-Reply-To: <12281180.1191600171182.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532707 ] Bryan Pendleton commented on DERBY-3108: ---------------------------------------- I think this is just the way TCP/IP works. You can only create TCP/IP connections at a certain rate, due to the mechanics of TIME_WAIT connection reclamation. Depending on your operating system, and certain parameters, the number of connections you can create per second will vary, but for all TCP/IP stacks and all machines there is some maximum rate at which you can create and reclaim connections. > Iteratively creating and closing client connection yields java.net.BindException: Address already in use: connect after many connections > ---------------------------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-3108 > URL: https://issues.apache.org/jira/browse/DERBY-3108 > Project: Derby > Issue Type: Bug > Components: Network Client, Network Server > Affects Versions: 10.4.0.0 > Reporter: Kathey Marsden > Attachments: ConnLoop.java > > > The attached program ConnLoop just creates client connections, uses them and then closes them. After about 3000 connections I get the following error. Also the memory usage seems to be increasing rapidly. This may be the cause of DERBY-2344. > [C:/kmarsden/repro/DERBY-2344] java ConnLoop > Apache Derby Network Server - 10.4.0.0 alpha - (578868M) started and ready to accept connections on port 1527 at 2007-10 > -05 15:56:57.500 GMT > 0:total memory: 5435392 free: 2749776 Fri Oct 05 08:57:09 PDT 2007 > 1000:total memory: 13701120 free: 10586720 Fri Oct 05 08:57:40 PDT 2007 > 2000:total memory: 20738048 free: 12805336 Fri Oct 05 08:58:09 PDT 2007 > 3000:total memory: 24006656 free: 11053832 Fri Oct 05 08:58:40 PDT 2007 > Exception in thread "main" java.sql.SQLNonTransientConnectionException: java.net.BindException : Error connecting to ser > ver localhost on port 1527 with message Address already in use: connect. > at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70) > at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:362) > at org.apache.derby.jdbc.ClientDriver.connect(ClientDriver.java:149) > at java.sql.DriverManager.getConnection(DriverManager.java:582) > at java.sql.DriverManager.getConnection(DriverManager.java:207) > at ConnLoop.main(ConnLoop.java:18) > Caused by: org.apache.derby.client.am.DisconnectException: java.net.BindException : Error connecting to server localhost > on port 1527 with message Address already in use: connect. > at org.apache.derby.client.net.NetAgent.(NetAgent.java:129) > at org.apache.derby.client.net.NetConnection.newAgent_(NetConnection.java:1086) > at org.apache.derby.client.am.Connection.(Connection.java:349) > at org.apache.derby.client.net.NetConnection.(NetConnection.java:209) > at org.apache.derby.client.net.NetConnection40.(NetConnection40.java:77) > at org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(ClientJDBCObjectFactoryImpl40.java > :209) > at org.apache.derby.jdbc.ClientDriver.connect(ClientDriver.java:140) > ... 3 more > Caused by: java.net.BindException: Address already in use: connect > at java.net.PlainSocketImpl.socketConnect(Native Method) > at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) > at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) > at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) > at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) > at java.net.Socket.connect(Socket.java:519) > at java.net.Socket.connect(Socket.java:469) > at java.net.Socket.(Socket.java:366) > at java.net.Socket.(Socket.java:179) > at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:196) > at org.apache.derby.client.net.OpenSocketAction.run(OpenSocketAction.java:62) > at java.security.AccessController.doPrivileged(Native Method) > at org.apache.derby.client.net.NetAgent.(NetAgent.java:127) > ... 9 more > [C:/kmarsden/repro/DERBY-2344] -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.