---------------------------------------------------------------- BEFORE YOU POST, search the faq at <http://java.apache.org/faq/> WHEN YOU POST, include all relevant version numbers, log files, and configuration files. Don't make us guess your problem!!! ---------------------------------------------------------------- Servlet crashes hard after 50-100 calls HELP?! I'm using: Windows Me Apache 1.3.14 ApacheJServ/1.1.2 jsdk2.0 jdk 1.2.2 & jdk 1.3 (either give same results) Things have been working beautifully... great work everyone! Now I'm pushing the envelope just a bit, and getting burned. I have a Servlet that uses a bit of JNI to serve up images. It is called repeatedly from an applet on the client side. It serves up images (64 x 64 JPEG encoded) like a dream about 50 times and then I get: ============================================== [16/02/2001 12:50:41:550 EST] <jservException> AJP Protocol Error: java.io.IOExc eption: Stream closed prematurely [16/02/2001 12:50:41:550 EST] <jservException> AJP Protocol Error: java.io.IOExc eption: Stream closed prematurely [16/02/2001 12:50:41:550 EST] <servletException> java.net.SocketException: Not c onnected: socket write error at java.net.SocketOutputStream.socketWrite(Native Method) at java.net.SocketOutputStream.write(SocketOutputStream.java, Compiled C ode) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java, C ompiled Code) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java, Compile d Code) at org.apache.jserv.JServConnection.sendError(JServConnection.java:1528) at org.apache.jserv.JServConnection.run(JServConnection.java, Compiled C ode) at java.lang.Thread.run(Thread.java:479) =============================================== There's _no_ delay before the [16/02/2001 12:50:41:550 EST] <jservException> AJP Protocol Error: java.io.IOExc eption: Stream closed prematurely Exception... it happens suddenly when the image is being served (Where normally this would happen if the client browser closed the stream before the servlet had finished) I have tried giving it more memory... wrapper.bin.parameters=-Xms32m -Xmx64m I've tried slowing down the client side so it only requests about 4 images / second and that didn't help at all. Memory use is not too bad... the problem occurs no matter how much RAM is free / allocated on the machine. the servlet itself has a service method that looks like this (I've removed most of the housekeeping code for clarity) =============================================== public void service (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // parameters: image filename with .fpx extension // left, top, right, bottom region coordinates in reduction-0 pixels // reduction the reduction // do we already have this image open? String fpxName; if (null == (fpxName = request.getParameter("image"))) { fpxName = "sorry.fpx"; } String fpxFull = fpxPrefix + fpxName; // Have we already opened the file? FpxOpenImage thisImage = (FpxOpenImage)itsOpenImages.get(fpxName); if (thisImage == null) { // open the file, and read the rectangle thisImage = new FpxOpenImage(); thisImage.fpxFile = new FpxLibWrapper(); thisImage.fpxFile.open(fpxFull); thisImage.numUses = 0; itsOpenImages.put(fpxName, thisImage); } long left = Long.parseLong(request.getParameter("left")); long top = Long.parseLong(request.getParameter("top")); long right = Long.parseLong(request.getParameter("right")); long bottom = Long.parseLong(request.getParameter("bottom")); int reduction = Integer.parseInt(request.getParameter("reduction")); reduction = Math.max(0, reduction); // negative reduction not handled yet thisImage.lastUse = System.currentTimeMillis(); thisImage.numUses++; byte[] jpegimage = thisImage.fpxFile.readRectangleJPEG(left, top, right, bottom, reduction); // ship the result on back response.setContentType("image/jpeg"); response.setHeader("Expires", "Tues, 01 Jan 1980 00:00:00 GMT"); // get the communication channel with the requesting client OutputStream out = response.getOutputStream(); out.write(jpegimage); // flush and close don't seem to make any difference. // out.flush(); // out.close(); jpegimage = null; // try to ensure gc } =============================================== Thank you soooooooooooooooooo much! -James Carroll -------------------- MicroBrightField Inc. -- -------------------------------------------------------------- Please read the FAQ! <http://java.apache.org/faq/> To subscribe: [EMAIL PROTECTED] To unsubscribe: [EMAIL PROTECTED] Search Archives: <http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/> Problems?: [EMAIL PROTECTED]