Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.4.0, 4.5.0, 4.6.0, 4.7.0
-
None
-
Camel Version: > 4.3.0
-
Unknown
Description
During a migration path that will take us from Camel 3.x to Camel 4.x we encountered a problem with one of our Routes.
Our Route tries to save the body of an http request to disk.
The raised error preventing the correct execution of the route is the following: "Cannot reset stream from file /tmp/camel-cache/cos7703786668416470635.tmp".
After debugging to understand the reason, I noticed that the execution flow compared to version 3 has changed with the introduction of the change that leads the WrappedInputStream class to implement the StreamCache -> Var headers interface (#12960).
In fact, a downgrade to version 4.3.0, the version prior to the introduction of the change, solved our problem and the route started working again.
The problem, which occurs when streamcaching spools to disk, is due to the fact that in the convertToStreamCache method of the StreamCachingHelper class the body of the message enters the else because it is an instance of StreamCache and does not continue towards the tryStreamCache method as in previous versions.
In our case, when we save the body of the http request to disk, the temp file used for spooling is deleted (FileInputStreamCache.cleanUpTempFile) before all StreamCache resets are performed (StreamCachingAdvice.after).
At that point, during the StreamCache reset, the code finds that the temp file has been deleted and raises the reported RuntimeCamelException exception.
I attached an example that reproduces the problem.
Attachments
Attachments
Issue Links
- relates to
-
CAMEL-2944 StreamCache - File spooled stream cache does not work well on Windows due not closing file resource
- Closed
-
CAMEL-19749 camel-core - Allow users to use variables in route to store data instead of headers
- Resolved
- links to