| Author |
Why does ServerSocket stop working after some time?
|
Michael Brown
Greenhorn
Joined: May 05, 2008
Posts: 27
|
|
Hi to all.
I have a following problem:
I wrote a multithread application that uses sockets ( TCP ), and use it to transfer some objects between computers in VPN.
It all works just fine, except that sometimes my server socket ( implemented as a separate Thread ) just stops working, and other computers cannot connect to it...?
I didn't specify setSOTimeout(), and did all Exception catch-ing in the thread.
Today, I had some >50000 connections in about 5 hours, and than it just stopped! My server socket stopped accepting any connections...
I restarted my application, and everything worked again properly...
Does anybody know why is this happening?
Please, any suggestion is appreciated....
Thank you.
|
 |
Rusty Shackleford
Ranch Hand
Joined: Jan 03, 2006
Posts: 490
|
|
Don't catch Exception,catch the actual exceptions. What were the exceptions?
Sounds like someone DOSed you.
|
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
|
 |
Michael Brown
Greenhorn
Joined: May 05, 2008
Posts: 27
|
|
Rusty Shackleford wrote:Don't catch Exception,catch the actual exceptions. What were the exceptions?
Sounds like someone DOSed you.
Unfortunately - no Exception was reported...
(I handle only the IOException because timeout was not previously set, there is no SecurityManager and no channel was associated with this socket )
Maybe I shoul use setSOTimeout()?
What does
someone DOSed you
means?
Again, ANY idea is appreciated...
|
 |
Moojid Hamid
Ranch Hand
Joined: Mar 07, 2009
Posts: 120
|
|
Are you closing the sockets in finally blocks when done?
DOS = Denial Of Service.
|
 |
Michael Brown
Greenhorn
Joined: May 05, 2008
Posts: 27
|
|
Moojid Hamid wrote:Are you closing the sockets in finally blocks when done?
DOS = Denial Of Service.
Yes I do.
And how do I prevent DOS attacks? Do you have any suggestion?
|
 |
luri ron
Ranch Hand
Joined: Dec 11, 2008
Posts: 86
|
|
with 50000 connections, you need to check your process resource utilization when the server hang:
1. number of threads
2. memory foot print
3. cpu usage
you can use jconsole to attach to your process, or issue a sigquit to your UNIX process to see the stack trace.
Also, i would suggest you load balance the traffic to more than one process for better scalability
|
 |
 |
|
|
subject: Why does ServerSocket stop working after some time?
|
|
|