Dropped Sockets?

J

Joshua Jung

Hi, I've built a client-server program that is designed to test server
load on a brand new Mac Pro machine of ours.

There are two programs: a server and a client generator. The server sits
idly waiting for connections (done in SSL), and the client just generates
a ton of clients at evenly spaced intervals (like every 100 milliseconds
or so).

For some reason, on the Mac machine, I get random "SocketConnection:
Socket Closed" errors when I try to do write operations. I can not trace
down any rhyme or reason as to why this is happening and nearly went crazy
trying to debug my code... and then I tried the same code on my Dell
Laptop running Ubuntu... worked like a charm!

Why would I be losing sockets like this?

Josh <><
 
T

Tom Forsmo

Joshua said:
Hi, I've built a client-server program that is designed to test server
load on a brand new Mac Pro machine of ours.

There are two programs: a server and a client generator. The server sits
idly waiting for connections (done in SSL), and the client just generates
a ton of clients at evenly spaced intervals (like every 100 milliseconds
or so).

For some reason, on the Mac machine, I get random "SocketConnection:
Socket Closed" errors when I try to do write operations. I can not trace
down any rhyme or reason as to why this is happening and nearly went crazy
trying to debug my code... and then I tried the same code on my Dell
Laptop running Ubuntu... worked like a charm!

Why would I be losing sockets like this?

The first thought that comes to mind is differing socket implementations
on mac and linux, the same goes for the jvm. You should try to isolate
what causes the problem.

First you should try to figure out if its an os problem or a
jvm/language problem.

- can you create a similar program on the mac in a different language,
preferably one using the kernel api directly, such as c/c++. If the
problem persists its an os problem, if not, its a jvm problem.
- is there a different jvm you could try on the mac. if the problem
persists it its probably a language problem (such as a bad
design/implementation decision or perhaps a faulty jvm conformance test.).

You could also try to reduce the number of running clients/open sockets
on the mac, to see if the problem persists. An that way try to find a
way around the problem

tom
 
J

Joshua Jung

Any hints would be appreciated at this point!

Sometimes the very first connection is dropped... sometimes no connections
are dropped and sometimes all of them work. It is entirely random!

I have also done a look at netstat on the Mac OS X machine after running
the test once with only 10 clients... where 1 of the clients bombed after
trying to do a write() operation and gave a

SocketException: Socket closed

Error. Netstat did indeed show that only 9 of the connections existed (and
they were all healthy, as well).

It just seems so unusual...

Josh <><
 
N

none

Joshua said:
Any hints would be appreciated at this point!

Sometimes the very first connection is dropped... sometimes no connections
are dropped and sometimes all of them work. It is entirely random!

I have also done a look at netstat on the Mac OS X machine after running
the test once with only 10 clients... where 1 of the clients bombed after
trying to do a write() operation and gave a

SocketException: Socket closed

Error. Netstat did indeed show that only 9 of the connections existed (and
they were all healthy, as well).

It just seems so unusual...

Josh <><
what is the network topology? are there firewalls between/on the
machines? any hardware routers that could be dodgy? if possible try
removing them temporarily. perhaps by connecting the two machines by a
crossover cable. Can you run a ping test from one machine to the other
during application use and see if there are any issues?

Tim
 
J

Joshua Jung

Ok, here's some more info:

No firewalls whatsoever.

The problem is the client generator... ONLY when it runs on Mac OS X.

Could this be a problem with the way Mac OS X implements SSL?

This doesn't make ANY sense to me now... I'm trying to rip apart my code
and debug things to see where the problem is occurring, but I'm having
quite a time doing it. The error(s) (socket closed, broken pipe etc.)
always occur on the server app (regardless of the type of machine) and the
client doesn't EVER report an error... so I had assumed it was the server
code, but apparently it's not... since the errors only show up on the
server when the client is run on Mac OS X.

Can you read too quickly from a socket after an SSL connection?

Need any help!

Josh <><
 
T

Tom Forsmo

Joshua said:
Ok, here's some more info:

No firewalls whatsoever.

The problem is the client generator... ONLY when it runs on Mac OS X.

Could this be a problem with the way Mac OS X implements SSL?

This doesn't make ANY sense to me now... I'm trying to rip apart my code
and debug things to see where the problem is occurring, but I'm having
quite a time doing it. The error(s) (socket closed, broken pipe etc.)
always occur on the server app (regardless of the type of machine) and the
client doesn't EVER report an error... so I had assumed it was the server
code, but apparently it's not... since the errors only show up on the
server when the client is run on Mac OS X.

Can you read too quickly from a socket after an SSL connection?

Does other java code, f.ex. created by another person/project, using ssl
work as expected, if so then the problem is your code, perhaps a
portability problem. If not it might be the ssl library or as I stated
earlier, the jvm.

If is your code that is the problem, you need to provide more details
about the code f.ex. some code samples with error messages etc. Or you
could pick up a book, or something, that you can use to help verify the
code.

tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top