• Post Reply Bookmark Topic Watch Topic
  • New Topic

The mysterious ConnectException  RSS feed

 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been experimenting with JUnitPerf to load test a server I'm writing using NIO. I've imposed no artifical limits on the number of concurrent connections. I believe Window's doesn't allow you to select() on more than 64 channels simultaniously, but I haven't hit numbers that high.
Here's the general idea. There's a class for testing, SmtpTest. In setUp() and tearDown() it connects and disconnects to the server, and there are a number of testBlahDiBlah() methods that have complete conversions with the server. The load test creates a number of threads which run through the whole sequence of tests 5 times for each thread. So thread one calls setUp(), testBlah1(), tearDown(), setUp(), testBlah2(), tearDown(), setUp(), testBlah1() again, etc. Thus the maximum number of connections at any given time will be the number of threads, although there will be quite a lot of connecting and disconnecting.
If there are only 10 threads, it runs without a hitch. The server will print out how many clients are registered with the Selector once every second.
With 10 threads running, here's the output from one run:

The 0's are when the server has just started or is done, so nothing to worry about there. For 10 clients, having 10 or 9 connected most of the time is pretty much ideal behavior.
If I up the number of threads to 15 there are 0 to 15 cases where connections are refused (interestingly enough they all happen only for the first test in the sequence of tests -- that must mean something...). The precise error is this:

The number of active threads at any given time hovers in the 10-15 range.
By the time I'm up to 25, connections are being refused all over the place (not just the first test in the sequence) and quite regularly. The number of connections at any given time seems to hover around 10-15, which is much lower than it ought to be with 25 clients running around. Here's what the server reports in it's polls every second:

Hardly looks like 25 active clients. If there are 50 client threads, the number of active connections still hovers in the same range.
Is there some obvious explanation that I'm missing? Is it perhaps a problem with the clients and not the server? Has the world gone mad?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought certain versions of Windows only allowed for 10 concurrent client connections. After that you had to license (pay for) their TCP/IP stack.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I have read is that the max number of connections to tcp/ip on NON SERVER editions of windows is 10. And there is no way to change that. At least none that I could find.
Whether or not that has anything to do with your problem I don't know. Because most of the places I read that was dealing with IIS.
Links:
http://www.devhood.com/messages/message_view-2.aspx?thread_id=44401
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gah! I'm developing in XP Pro. *At this point David shakes his fist while cursing in broken Italian*
This applies to connections from a computer to itself? Those evil ********!
And the truely tragic part is that I have a brand new laptop waiting for me with plenty of space to install a happy, industrial strength, open source OS. But alas, I'll have to run the gauntlet past more evil before I can use the hardware.
Thanks for info.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lasciate ogne speranza, voi ch'intrate.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javaranch people are funny.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!