Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-21162

Cannot reset StreamCache when the spool file has been deleted

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.4.0, 4.5.0, 4.6.0, 4.7.0
    • 4.8.0
    • camel-core
    • 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

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              cstorti Cristian
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: