Importing Backup Results in 'Address Already in Use Connect' Error
Symptoms
When importing a backup on Windows the following error occurs:
Failed to import data: Error in action: com.atlassian.jira.action.admin.DataImport@15c0102, result: error Error importing data: org.apache.commons.lang.exception.NestableException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: Exception while inserting the following entity: [GenericEntity:Action][id,90585][body,page created. pulls email template from exact target and uses SMTP to send.][author,ceaton][\][\][issue,33494][type,comment][updateauthor,ceaton] (Unable to establish a connection with the database. (Network error IOException: Address already in use: connect))
Cause
Windows limits the range of "client" ports to 1024-5000 and does not close connections fast enough which causes the Network I/O exception.
Resolution
Adjust a registry setting to increase the port range beyond 5000. If the server already has a lot of connections open and there aren't any ports available in the 1024-5000 range, use netstat to determine if this is true. If it looks like JIRA is making a lot of connections to the database on import and TIME_WAIT by TCP spec has a life of 4 minutes, then the system has reached its cap.
The default maximum number of ephemeral TCP ports is 5000 in the products that are included in the 'Applies to' section. A new parameter has been added in these products.
To increase the maximum number of ephemeral ports, follow these steps:
- Start Registry Editor (
Start >> Run >> Regedit
- Make a Registry backup
- Locate the following subkey in the registry, and then click Parameters:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
On the Edit menu, click New, and then add the following registry entry:
Value Name: MaxUserPort Value Type: DWORD Value data: 65534 Valid Range: 5000-65534 (decimal) Default: 0x1388 (5000 decimal) Description: This parameter controls the maximum port number that is used when a program requests any available user port from the system. Typically , ephemeral (short-lived) ports are allocated between the values of 1024 and 5000 inclusive.
- Exit Registry Editor, and then restart the computer.
An additional TCPTimedWaitDelay registry parameter determines how long a closed port waits until the closed port can be reused as described in this Microsoft Article.