Bug 1044416

Summary: Camel Splitter does not close Closable on RuntimeException
Product: [JBoss] JBoss Fuse Service Works 6 Reporter: zaugg+bugzilla
Component: CamelAssignee: Tomohisa Igarashi <toigaras>
Status: MODIFIED --- QA Contact: Matej Melko <mmelko>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: aileenc, atangrin, ganandan, jcordes, serviceworks, soa-p-jira, tschan+redhat
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
The Camel Splitter does not close the Closable Iterator if a RuntimeException occurs during its iteration. Thus the splitter does not close cleanly.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Enhancement
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description zaugg+bugzilla 2013-12-18 09:40:25 UTC
Description of problem:
Camel Splitter does not close Closable Iterator if a RuntimeException occurs during iteration.

Version-Release number of selected component (if applicable):
Camel 2.10.0

How reproducible:
throw a RuntimeException in Closable Iterator in a Splitter Processor

Steps to Reproduce:
1. create route .split().method(MyClosableIteratorFactory.class, "createIterator")
2. throw a RuntimeException in MyClosableIterator.next() method

Actual results:
close() method does not get called

Expected results:
close() method of Closable Iterator should get called in finally block of Camel Splitter class.

Additional info:

Comment 2 kconner 2013-12-18 14:12:15 UTC
Is this within the context of FSW or Fuse?

Comment 3 Daniel Tschan, Puzzle ITC 2013-12-18 15:13:11 UTC
We encountered the issue while implementing a PoC for a customer based on JBoss Fuse Service Works 6 Beta (Build ER6).

Comment 5 Gomathi Anandan 2014-10-24 19:08:24 UTC
Resetting the flags back to the state it was before Oct-24- 2PM. There was an incorrect bulk update that I'm trying to fix.

Comment 6 tcunning 2015-02-16 16:53:47 UTC
Tomo, can you try to reproduce?   If this still exists in Camel 2.14.0, I guess we need to submit a pull against Camel.

Comment 7 Tomohisa Igarashi 2015-02-17 08:02:45 UTC
The issue still exists in camel-2.14.0, however I think it's an enhancement request rather than a bug, as Iterable is not always Closeable, and there's no rule to close Iterable when it throws RuntimeException. If user provided Iterable throws RuntimeException on next() or hasNext(), then it can close itself right before throwing it. Having said that, I'll try to see if this enhancement is acceptable for Apache camel.

Comment 8 Aileen 2015-02-17 08:50:27 UTC
Can you add link the to Camel jira?

Comment 9 Tomohisa Igarashi 2015-02-18 02:58:32 UTC
Sent a pull request to camel upstream

Comment 10 Tomohisa Igarashi 2015-02-18 07:33:31 UTC
It has been merged into upstream