Technical Blog Post
75 ways to demystify DB2 #80: Techtip : IDB2 JCC Exception -4499 : No buffer space available (maximum connections reached?)
Users may receive the following JCC error on Windows platform:
FATAL notify - Exception in <dbname>
Message --> [jcc][t4][3.57.82] Exception java.net.SocketException: Error opening socket to server /xxx.xx.xx.xx on port 50,000 with message: No buffer space available (maximum connections reached?): connect. ERRORCODE=-4499, SQLSTATE=08001
ErrorCode --> -4499
This error can be caused by a few reasons, below are the causes and fixes:
Cause 1. User may have encountered the windows socket leak bug.
Cause 2. Physical limitation, user may not have sufficient system resources.
Cause 3. Windows configuration, user may need to increase the ephemeral (short-lived) TCP ports numbers on Windows.
Cause 4. Application opens too many physical connections to the database and ended up reaching the max connection limit on db2. This can be verified by one of the following methods :
a. checking "netstat -an" output by checking the number of established connections, you may see a large number of established connections and output similar to the following:
TCP 172.16.81.70:50000 PHRTMMINA:63433 ESTABLISHED
TCP 172.16.81.70:50000 PHRTMMINA:63434 ESTABLISHED
TCP 172.16.81.70:50000 PHRTMM
This shows the connections are reaching the limitation of 65534.
b. checking "db2 get snapshot for dbm" output, in this output you need to look for the following variables:
High water mark for agents registered = 30455
Agents registered = 17071
Idle agents = 0
this example shows that the peak number of agents connected to DB2 is 30455, which is abnormally high.
These are the indicators that the application users use is opening too many connections and reaching the max connection limitation.
Checking all causes listed above will help diagnose the exact problem.
Following are the fixes corresponding to the causes above :
Fix 1. User needs to apply Microsoft hotfix from http://support.microsoft.com/kb/2577795
Fix 2. Check user's system and expand system resources required, for example, memory.
a. Open "Registry Editor" with administrator privilege
b. Navigate to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
c. Add a variable name "MaxUserPort" type REG_DWORD and set its value to 65534 base decimal.
Fix 4. We cannot fix this, the fix is with the application. User will have to modify their application so that it does not open that many connections to DB2, or, to reuse the connections.