shashank created CAMEL-27209:
--------------------------------
Summary: camel-stream - a stream:http consumer with scanStream
stops reading for good when the HTTP server cannot be reached or the connection
is lost, also with retry=true
Key: CAMEL-27209
URL: https://issues.apache.org/jira/browse/CAMEL-27209
Project: Camel
Issue Type: Bug
Components: camel-stream
Reporter: shashank
Assignee: shashank
h3. What happens
The {{stream}} consumer reads in one task on its own thread. With
{{scanStream=true}} that task loops for as long as the consumer runs, and with
{{retry=true}} it opens the stream again at its end. For {{stream:http}} an
{{IOException}} ends the task:
* opening the URL fails (the server cannot be reached, or answers with an error
status such as 503): at the start of a scanning consumer (it does not open the
stream in {{doStart}}, to be lenient), or when it opens the stream again
({{retry=true}}) after the server closed the response;
* reading a line fails (the connection is lost in the middle of a response).
The exception reaches the exception handler once (a WARN), the task ends, and
the consumer stays started without reading anything any more, until the route
is restarted. A server that restarts, or a network glitch, is enough.
{{stream:file}} is not affected for a file that does not exist (it is opened
again later), and the raw mode ({{readLine=false}}) ignores read errors but
ends the same way when the stream cannot be opened again.
h3. How to reproduce
{{StreamHttpScanRetryTest}} (camel-stream, a minimal HTTP server): the server
answers the first request, fails the second one with 503 (or resets the
connection in the middle of a body) and answers again afterwards; the consumer
never routes the data of the later answers.
h3. Fix
In scan mode a stream that cannot be opened or read is reported (the first
failure in a row to the exception handler, the next ones at DEBUG) and treated
as the end of the stream: with {{retry=true}} it is opened again, after at
least one second when it failed, so a server that is down is not asked in a
loop. Without {{retry}} the behaviour is that of a stream that ended. The
consumer that does not scan is unchanged.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)