Hello,

I am getting some exceptions when testing my application -- particularly 
under load.

The pattern looks like this (copied from stderr):

===========================================
http://[....]:8182/ontologyVersions/148
Mar 10, 2009 11:03:04 AM com.noelios.restlet.http.HttpServerConverter commit
INFO: The connection was broken. It was probably closed by the client.
java.io.IOException: Broken pipe
        at sun.nio.ch.FileDispatcher.write0(Native Method)
        at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
        at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
        at sun.nio.ch.IOUtil.write(IOUtil.java:75)
        at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
        at java.nio.channels.Channels.write(Channels.java:60)
        at java.nio.channels.Channels.access$000(Channels.java:47)
        at java.nio.channels.Channels$1.write(Channels.java:134)
        at 
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
        at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
        at 
com.noelios.restlet.http.ChunkedOutputStream.writeBuffer(ChunkedOutputStream.java:135)
        at 
com.noelios.restlet.http.ChunkedOutputStream.writeChunk(ChunkedOutputStream.java:147)
        at 
com.noelios.restlet.http.ChunkedOutputStream.write(ChunkedOutputStream.java:123)
        at java.io.OutputStream.write(OutputStream.java:99)
        at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
        at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263)
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106)
        at java.io.OutputStreamWriter.write(OutputStreamWriter.java:190)
        at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:111)
        at java.io.BufferedWriter.flush(BufferedWriter.java:235)
        at freemarker.core.Environment.process(Environment.java:191)
        at freemarker.template.Template.process(Template.java:237)
        at 
org.restlet.ext.freemarker.TemplateRepresentation.write(TemplateRepresentation.java:347)
        at 
com.noelios.restlet.http.HttpServerCall.writeResponseBody(HttpServerCall.java:492)
        at 
com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServerCall.java:428)
        at 
com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java:391)
        at 
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148)
        at 
com.noelios.restlet.http.StreamServerHelper$ConnectionHandler.run(StreamServerHelper.java:86)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)
Mar 10, 2009 11:03:04 AM com.noelios.restlet.http.StreamServerCall complete
WARNING: Unable to shutdown server socket
java.net.SocketException: Transport endpoint is not connected
        at sun.nio.ch.SocketChannelImpl.shutdown(Native Method)
        at 
sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:640)
        at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:360)
        at 
com.noelios.restlet.http.StreamServerCall.complete(StreamServerCall.java:102)
        at 
com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java:416)
        at 
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148)
        at 
com.noelios.restlet.http.StreamServerHelper$ConnectionHandler.run(StreamServerHelper.java:86)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)
===========================================

There is none of the usual AfterHandle log entries for that URL, just the 
URL itself in front of the stack trace (I removed the server name).

I'm using the Restlet engine (errors seem to appear both with 1.1.2 and 
1.1.3). I tried on a Java 1.6.0_10 on Kubuntu 8.10 and a Java 1.6.0_02 on 
Centos 4.7 (yes, that Java is in urgent need of updating) with the same 
results. Restlet is 1.1.2/3, too, as is the Freemarker extension. Freemarker 
comes in as indirect dependency, for restlet-freemarker 1.1.3 it seems to be 
a 2.3.15.

The affected request is the URL above, the client gets a partial result 
(note: in this case the full result of this particular request is ~54MB of 
HTML). I've seen these exceptions with GETs and POSTs and with different 
clients (at least Firefox3, Commons HttpClient). It seems to correlate with 
content size (as expected) but not necessarily with general load (the 
HttpClient code can submit entries in parallel -- tweaking the throttle 
there doesn't seem to affect results significantly).

Does anyone have some ideas what the problem could be? Hints for debugging?

TIA,
   Peter

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1300185

Reply via email to