SYN_SENT issue from java program
In my app, when my application server starts, i am creating 5 threads and each thread is a as400 server database connection. And each thread(java program) will make a as400 connection for every one minute. But weekly, for few reasons, one of as400 database server goes down for 1-2 hours and java thread associated hits this DB server for every one minute. At this point time my 开发者_开发百科web App is stuck and I can't even access the URL.
And from the linux console, when I did netstat -an, I had seen one server status is SYN_SENT which is down.
Thanks in advance for your help.
You could try to adjust the various socket options. Guide here: http://download.oracle.com/javase/1.4.2/docs/guide/net/socketOpt.html
Maybe you should use some kind of [database] connection pool, rather than opening a new connection every minute.
The server simply doesn't accept connections and the code connecting doesn't use any meaningful timeout, nor it's made to detect faulty servers. SYN_SENT means that the remote machine (AS/400) doesn't establish the connection. If possible try and remove that particular server from the list of the available ones.
If you open the connections directly (yourself): post your code. I will help you do it w/ a timeout and eventually loop among the available servers.
精彩评论