Hi Esmond
I haven't said a word about your second program, that closes the
listening socket. *Of course* that causes connection refusals, it
can't possibly not, but it isn't relevant to the misconceptions about
what OP_ACCEPT does that you have been expressing here and that I have
been addressing.
I was learning things while discussing this issue over the Tomcat list.
I started out asking the Tomcat community why I saw the hard RST
behavior, and then started looking at the source of Tomcat, and then
referenced the HttpComponents project - where at first I believed it was
turning off interest in OP_ACCEPT - an assumption I was wrong about -
since I had looked up only the discussion threads of HttpComponents and
not the source.
Then I wrote the second program to illustrate how HttpComponents handled
it after looking at its source code, and to answer the question posed by
Chris on how "it" was done in HttpComponents. Since then I was basing my
discussion around that second program, but I believe you were addressing
issues from earlier - I apologize.
Closing the listening socket, as you seem to be now suggesting, is a
very poor idea indeed:
I personally do not think there is anything at all bad about turning it
off. After all, if you are not ready to accept more, you should be clear
and upfront about it, even at the TCP level. Having different thresholds
to stop listening (say at 4K), and to resume (say at 2K) would ensure
that you do not start acting weirdly by starting/stopping/starting/..
acceptance around just one value.
what happens if some other process grabs the port in the meantime:
what is Tomcat supposed to do then?
In reality I do not know of a single client production deployment that
would allocate the same port to possibly conflicting services, that may
grab another's port when its suffering under load.
I cannot see any other issues of turning off accepting - and I am
curious to know if anyone else could share their views on this -
considering real production deployments
regards
asankha
--
Asankha C. Perera
AdroitLogic, http://adroitlogic.org
http://esbmagic.blogspot.com