camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ulrich Kramer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-6991) Problem with stream caching and DefaultHttpBinding.writeResponse
Date Fri, 22 Nov 2013 06:21:40 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-6991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13829696#comment-13829696
] 

Ulrich Kramer commented on CAMEL-6991:
--------------------------------------

With the following example you can reproduce the problem when you set two breakpoints:

# CachedOutputStream line: 209  cleanUpTempFile()	
# FileInputStreamCache line: 110  createInputStream(File)	

cleanupTempFile is called first. createInputStream creates an IOException because the file
is already removed.

{code}
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(new RouteBuilder() {

            @Override
            public void configure() throws Exception {
                from("direct:input").to("jetty:http://localhost:55555/input");
                from("jetty:http://localhost:55555/input").process(new Processor() {

                    @Override
                    public void process(final Exchange exchange) throws Exception {
                        Assert.assertFalse(exchange.hasOut());
                    }
                });
            }
        });
        context.start();
        ProducerTemplate template = context.createProducerTemplate();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 10000; i++) {
            sb.append("0123456789");
        }
        template.sendBody("direct:input", sb.toString());
        while (true) {
            Thread.sleep(1000);
        }
{code}

> Problem with stream caching and DefaultHttpBinding.writeResponse
> ----------------------------------------------------------------
>
>                 Key: CAMEL-6991
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6991
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-http
>    Affects Versions: 2.11.2
>         Environment: Debian 7
>            Reporter: Ulrich Kramer
>
> DefaultHttpBinding.writeResponse was modified between 2.11.0 and 2.11.2. This yields
to a problem with stream caching. 
> When exchange.out is not set target (DefaultHttpBinding.java:215)  is assigned to exchange.in
. exchange.in may contain a body which is already removed by an onCompletion callback. In
DefaultHttpBindung.java:377 this body is read. This may yield to an exception



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message