Hello Jerome , Thierry, I'm was using the Restlet to serve the pdf retrievals and while I was testing I found that InputRepresentation.release() method is not closing the inputstream properly if there is any socket exception or IO exception. I tested with Restlet 1.1.10 and Restlet 2.0.2 version. but problem is existed in both versions.
And I made the changes to source code(Restlet 1.1.0) to address this problem. there are two ways to resolve this issue. 1) Changing the InputRepresentation release() method implementation, Instead of creating the local 'result' variable inside the getStream() method declare it as class level variable and use 'result' variable in release() method to close the stream. or 2) Wrapping the try-catch exception block for write method in in ByteUtils(Line 970) and closing the inputstream inside the catch block if there is any IO Exception. I'm attaching the changed source files and my test file which I used to produce this bug. by the way to produce this bug in my test code I used ‘socket time out’ value to be small(1000 mills). let me know If I'm wrong... Attached files are(These files are from Restlet 1.1.10) as I mentioned same issue is existed in 2.0 version code also. http://restlet-discuss.1400322.n2.nabble.com/file/n5722563/ByteUtils.bmp ByteUtils.bmp http://restlet-discuss.1400322.n2.nabble.com/file/n5722563/InputRepresentation.java InputRepresentation.java http://restlet-discuss.1400322.n2.nabble.com/file/n5722563/InputRepresentationTest.java InputRepresentationTest.java http://restlet-discuss.1400322.n2.nabble.com/file/n5722563/ByteUtils.java ByteUtils.java Thanks, Somu Here is the exception stack trace java.io.IOException: Broken pipe at simple.http.MonitoredOutputStream.destroy(MonitoredOutputStream.java:159) at simple.http.MonitoredOutputStream.write(MonitoredOutputStream.java:111) at simple.http.ResponseStream.write(ResponseStream.java:141) at org.restlet.util.ByteUtils.write(ByteUtils.java:975) at org.restlet.resource.InputRepresentation.write(InputRepresentation.java:119) 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:392) at com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148) at com.noelios.restlet.ext.simple.SimpleProtocolHandler.handle(SimpleProtocolHandler.java:75) at simple.http.Dispatcher.run(Dispatcher.java:83) at simple.util.process.Daemon.execute(Daemon.java:121) at simple.util.process.Daemon.run(Daemon.java:106) 2010/11/09 15:42:35:375 EST [DEBUG] DefaultClientConnection -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/InputStream-In-not-closing-properly-in-InputRepresentation-Class-tp5722563p5722563.html Sent from the Restlet Discuss mailing list archive at Nabble.com. ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2680531

