• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why does ServerSocket stop working after some time?

 
Michael Brown
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 490
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't catch Exception,catch the actual exceptions. What were the exceptions?

Sounds like someone DOSed you.
 
Michael Brown
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you closing the sockets in finally blocks when done?

DOS = Denial Of Service.
 
Michael Brown
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic