When an application uses a database connection pool for data connections, the firewall's settings can cause the connection to time out or be reset. When reading data from the database, it is possible to Connection timed out, this is because the application will cache the data connection, when to access the database, but this time the cached database connection may be because the firewall settings have timed out or been destroyed by the database.
Problem Description:
After the system is cut, the middleware and the database have been isolated from the firewall, because the database and application have been cut, the system architecture from the original single network into a cross-system deployment, access between the database and the application through the firewall, and the firewall side of the idle connection configured time-out (the default is 30 minutes), Once the time is exceeded, the connection is automatically broken, and after it is broken, the database connection pool on this side of the application still thinks the connection is valid, it will only perform a validity test when the application obtains the connection, it will try once every interval of time, try N times before determining that the connection is invalid, initiate a reconnection, The end result is a long business time.
Due to the large number of connection pool connections, it is bound to cause some connection idle time exceeds the firewall settings, and the application side is not configured to the idle connection maintenance parameters, idle connection will always be considered valid, so the phenomenon will only appear in the connection pool idle connection, when the app gets disconnected by the firewall idle connection, Will cause the application to respond slowly, or directly prompt for connection timed out exception.
Workaround:
For this phenomenon, the solution generally has the following:
1, the connection pool this piece of the parameter optimization, increase the idle connection unused timeout and aging timeout (less than the configuration of the firewall), optimize the existing connection validity test correlation times and interval configuration, so that the application side from the connection pool to obtain the connection is valid, Avoid being killed by a firewall for a long time without data manipulation;
2. Cancel the timeout setting for the database connection in the firewall.
A more detailed description and a description of such issues can be found in the following
Http://www.ibm.com/developerworks/cn/aix/library/0808_zhengyong_tcp/index.html
Reprinted from: https://www.cnblogs.com/sunguangran/p/3482305.html
Oracle connection issues due to firewall settings causing timeouts