0

Using Camel 2.8.0
Using Jetty 7.5.4

from("jetty://http://myESBserver/large/resource?matchOnUriPrefix=true&bridgeEndpoint=true&enableMultipartFilter=false&disableStreamCache=true&continuationTimeout=1440000")  
.to("jetty://http://myWEBserver/large/resource?bridgeEndpoint=true&throwExceptionOnFailure=false");

This route works on smaller resources. I am asking Camel to proxy requests without modification (with logging after exchange is complete). The document I am trying to proxy is quite large (about 7G).

karaf log:

16:11:15,201 | ERROR | qtp59894565-976  | DefaultErrorHandler              | ?                                   ? | 56 - org.apache.camel.camel-core - 2.8.0 | Failed delivery for exchangeId: ID------46702-1385393650256-95-3. Exhausted after delivery attempt: 1 caught:         org.apache.camel.CamelExchangeException: JettyClient failed cause by: Negative initial size: -1034012518. Exchange[Message: [Body is null]]. Caused by: [java.lang.IllegalArgumentException - Negative initial size: -1034012518]
org.apache.camel.CamelExchangeException: JettyClient failed cause by: Negative initial size: -1034012518. Exchange[Message: [Body is null]]. Caused by: [java.lang.IllegalArgumentException - Negative initial size: -1034012518]
    at org.apache.camel.component.jetty.JettyContentExchange.doTaskCompleted(JettyContentExchange.java:205)[86:org.apache.camel.camel-jetty:2.8.0]
    at org.apache.camel.component.jetty.JettyContentExchange.onException(JettyContentExchange.java:135)[86:org.apache.camel.camel-jetty:2.8.0]
    at org.eclipse.jetty.client.HttpExchange$Listener.onException(HttpExchange.java:1094)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    at org.eclipse.jetty.client.HttpConnection.handle(HttpConnection.java:319)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586)[69:org.eclipse.jetty.io:7.5.4.v20111024]
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44)[69:org.eclipse.jetty.io:7.5.4.v20111024]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)[77:org.eclipse.jetty.util:7.5.4.v20111024]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)[77:org.eclipse.jetty.util:7.5.4.v20111024]
    at java.lang.Thread.run(Thread.java:662)[:1.6.0_31]
Caused by: java.lang.IllegalArgumentException: Negative initial size: -1034012518
    at java.io.ByteArrayOutputStream.<init>(ByteArrayOutputStream.java:57)[:1.6.0_31]
    at org.eclipse.jetty.client.ContentExchange.onResponseContent(ContentExchange.java:99)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    at org.eclipse.jetty.client.HttpExchange$Listener.onResponseContent(HttpExchange.java:1163)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    at org.eclipse.jetty.client.HttpConnection$Handler.content(HttpConnection.java:657)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:801)[74:org.eclipse.jetty.http:7.5.4.v20111024]
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:224)[74:org.eclipse.jetty.http:7.5.4.v20111024]
    at org.eclipse.jetty.client.HttpConnection.handle(HttpConnection.java:279)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    ... 5 more
0

1 Answer 1

0

The code uses a ByteArrayOutputStream internally, which is limited in terms of its maximum size to Integer.MAX_VALUE - about 2GB.

There's another bug before this that a long is somehow being downcasted into an integer, but the ByteArrayOutputStream thing looks to be the fundamental problem.

So it seems you will have to either split the data into separate chunks or use a different approach.

2
  • So you are telling me Camel will insist on always reading the entire response into memory before passing it along to the client? Dec 3, 2013 at 16:22
  • I have no idea - I just inferred this from looking at the stack trace. Dec 3, 2013 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.