Time for me to admit I was wrong…
All the time I’ve been getting ColdFusion errors stating that the server cannot support any more connections… it wasn’t the server, it was some code I had written.
I’m still not sure of the why it caused the problems that it did, but it certainly did.
The issue at hand was my Captcha images that i was generating on the fly.
The idea was I would generate a BufferedImage , draw all my stuff on it, grab the HttpServletResponse OutputStream from the getPageContext() and then use the com.sun.image.codec.jpeg.JPEGCodec to encode said OutputStream to my captcha.
In theory this should all work like a charm.
Except for one very irritating thing. It doesn’t.
Occasionally when multiple requests go for the JpegEncoder, ColdFusion decides to go totally belly up. Not even in a nice error message way, nope, in a ‘Oh my G-d, I’ve totally dropped my &%$#’ way.
It even got to the point where it was dropping out the whole server.
The way I have gotten around it now, is by writing the image to a file, and every so often replacing it with a new Captcha image and text. It seems to be working very nicely, and with some locking, ensures that it should only get hit one at a time.
So, in the future, I highly recommend not encoding the OutputStream of the HttpServletResponse – write it to a file, and access it that way.