camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aki Yoshida <elak...@gmail.com>
Subject Re: To many opened files
Date Mon, 17 Sep 2012 09:55:58 GMT
I think there is an issue in JettyHttpProducer.

    public boolean process(Exchange exchange, final AsyncCallback callback) {
        JettyContentExchange httpExchange = null;
        try {
            httpExchange = createHttpExchange(exchange, callback);
            doSendExchange(client, httpExchange);
        } catch (Exception e) {
            // error occurred before we had a chance to go async
            // so set exception and invoke callback true
            exchange.setException(e);
            callback.done(true);
            return true;
        }

        // we should continue processing this asynchronously
        return false;
    }

createHttpExchange(exchange, callback) may open an input stream and
set it to httpExchange. When something goes wrong in doSendExchange,
this input stream may not be closed. So, I put a finally block there
which checks if the input stream in available in httpExchange and if
so, closing it. That released the file. Or something of this kind
could go into doSendExchange.

regards, aki

2012/9/17 Kramer, Ulrich <u.kramer@sap.com>:
> Hello!
>
> in Apache Camel 2.10.1 the following route leaves the files in the source directory opened,
if the destination is not reachable. Every second the number of opened files (lsof -p <pid>)
is increased by 2.
>
> from("file:/tmp/inbox").to(""jetty:http://localhost:12345/xxx")
>
> But the route
>
> from("file:/tmp/inbox").throwException(new Exception("Test"))
>
> works fine. Is this a bug?

Mime
View raw message