[jetty-user] Fwd: EofException on request with large body

Piotr Sarnacki <[email protected]>
Newsgroups gmane.comp.java.jetty.support
Message-ID <[email protected]>
Hi,

I have a problem with HttpClient and sending large body. I try to send the
most basic POST request with body around 2M set using
setRequestContentSource. When I use plain FileInputStream, everything is
fine, but when I switch to custom stream implementation, I get EofException.
It's non deterministic, so I suspect that it's some kind of race condition.

The thing that is different in custom stream implementation is available()
method. For FileInputStream it equals to entire stream size and for custom
stream it's 4096. Now the question is if it's ok to return 4096 from
available method? If yes, that is jetty's issue, if no, I should change the
implementation. If you know the answer can you also give any arguments for
it?

The backtrace that I get in this situation looks like that:
2011-03-14 20:58:33.706:WARN::EXCEPTION HttpExchange@1650314950=POST//
127.0.0.1:4001/#9
org.eclipse.jetty.io.EofException
at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:911)
at org.eclipse.jetty.client.HttpConnection.handle(HttpConnection.java:241)
 at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:520)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
 at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:528)
at java.lang.Thread.run(Thread.java:680)
Caused by:
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:100)
at sun.nio.ch.IOUtil.write(IOUtil.java:71)
 at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
at org.eclipse.jetty.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:195)
 at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:285)
at org.eclipse.jetty.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:316)
 at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:267)
at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:846)
 at org.eclipse.jetty.client.HttpConnection.handle(HttpConnection.java:241)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:520)
 at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:528)
 at java.lang.Thread.run(Thread.java:680)

Piotr

-- 
Piotr Sarnacki
http://piotrsarnacki.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.