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

camel-zipfile - Stream close while unzipping

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Cannot Reproduce
    • 3.20.8
    • None
    • camel-zipfile
    • None
    • Unknown

    Description

      As discussed on the mailing list:

      https://lists.apache.org/thread/gkzpjsrdxwrc2jsh82vp92dzdlympjtf

      Sometimes when unzipping a zip file I get an error:

      org.apache.camel.StreamCacheException: Error during type conversion
      from type: org.apache.camel.dataformat.zipfile.ZipInputStreamWrapper
       to the required type: org.apache.camel.StreamCache with value
      org.apache.camel.dataformat.zipfile.ZipInputStreamWrapper@10538c67
      due to org.apache.camel.TypeConversionException: Error during type
      conversion from type:
      org.apache.camel.dataformat.zipfile.ZipInputStreamWrapper
       to the required type: org.apache.camel.StreamCache with value
      org.apache.camel.dataformat.zipfile.ZipInputStreamWrapper@10538c67 due
      to java.io.IOException: Stream closed 

      I don't know how far this is related to other issue with ZipFile:

      https://issues.apache.org/jira/browse/CAMEL-19849

      The strange thing is that is seems to work in some environments and fails in others.

      I tested it with Camel 3.20.8 / JDK

      For example:

      1. Local (build from source / Windows 11) --> Works
      2. Local (Docker image / Docker Desktop) --> Works
      3. Local (build from source / MacOS) --> Works
      4. AWS (Docker image running on Ubuntu) --> Fails

      I tried to copy the source of ZipFile to my own program to get some more information, but it seems that the error is more related to the Camel Support module. Nevertheless I got some more logging out of it.

      My route:

      <route id="zip">
          <from uri="direct:zip_in"/>
          <unmarshal>
              <zipFile usingIterator="true"/>
          </unmarshal>
          <split streaming="true">
              <simple>${body}</simple>
              <to uri="zip_out"/>
          </split>
      </route> 

      The log:

      2023-11-07 17:41:41.400 ERROR 1 --- [p1242793343-101] o.a.d.b.e.ID_6537e1053fad4b0013000109    : Failed delivery for (MessageId: A531BE75947BFB1-000000000000037D on ExchangeId: A531BE75947BFB1-000000000000037D). Exhausted after delivery attempt: 1 caught: org.apache.camel.StreamCacheException: Error during type conversion from type: org.assimbly.archive.ZipInputStreamWrapper to the required type: org.apache.camel.StreamCache with value org.assimbly.archive.ZipInputStreamWrapper@3e6184af due to org.apache.camel.TypeConversionException: Error during type conversion from type: org.assimbly.archive.ZipInputStreamWrapper to the required type: org.apache.camel.StreamCache withvalue org.assimbly.archive.ZipInputStreamWrapper@3e6184af due to java.io.IOException: Stream closed. Processed by failure processor: FatalFallbackErrorHandler[Channel[setExchangePattern76]]Message History
      ---------------------------------------------------------------------------------------------------------------------------------------
      Source                                   ID                             Processor                                          Elapsed (ms)
      xml:2                                    ID_6537e1053fad4b0013000109-6d from[direct-vm://ID_654a65bc741e4f00070007da_test_     40341190
      xml:8                                    ID_6537e1053fad4b0013000109-6d direct-vm:ID_654a65bc741e4f00070007da_test_6df7e1e            0
      xml:5                                    onException138/setExchangePatt setExchangePattern[InOnly]                                    0Exchange
      ---------------------------------------------------------------------------------------------------------------------------------------
      Exchange[
              Id                  A531BE75947BFB1-000000000000037D
              Headers             {Accept=*/*, breadcrumbId=A531BE75947BFB1-000000000000037B, CamelFileName=enrich3.txt, CamelRedelivered=false, CamelRedeliveryCounter=0, CamelServletContextPath=/regressiontests/ArchiveUnpack, Connection=close, Content-Length=1070, Content-Type=application/zip, Host=assimbly-test:9001, User-Agent=curl/7.84.0, zipFileName=enrich3.txt}
              BodyType            org.assimbly.archive.ZipInputStreamWrapper
              Body                [Body is instance of java.io.InputStream]
      ]Stacktrace
      ---------------------------------------------------------------------------------------------------------------------------------------org.apache.camel.StreamCacheException: Error during type conversion from type: org.assimbly.archive.ZipInputStreamWrapper to the required type: org.apache.camel.StreamCache with value org.assimbly.archive.ZipInputStreamWrapper@3e6184af due to org.apache.camel.TypeConversionException: Error during type conversion from type: org.assimbly.archive.ZipInputStreamWrapper to the required type: org.apache.camel.StreamCache with value org.assimbly.archive.ZipInputStreamWrapper@3e6184af due to java.io.IOException:Stream closed
              at org.apache.camel.impl.engine.CamelInternalProcessor$StreamCachingAdvice.before(CamelInternalProcessor.java:936)
              at org.apache.camel.impl.engine.CamelInternalProcessor$StreamCachingAdvice.before(CamelInternalProcessor.java:887)
              at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:335)
              at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:829)
              at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:737)
              at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:181)
              at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59)
              at org.apache.camel.processor.Pipeline.process(Pipeline.java:165)
              at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:392)
              at org.apache.camel.component.jetty.CamelContinuationServlet.doService(CamelContinuationServlet.java:245)
              at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:130)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
              at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
              at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656)
              at org.apache.camel.component.jetty.MultiPartFilter.doFilter(MultiPartFilter.java:50)
              at org.apache.camel.component.jetty.CamelFilterWrapper.doFilter(CamelFilterWrapper.java:49)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
              at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
              at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
              at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
              at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
              at org.eclipse.jetty.server.Server.handle(Server.java:516)
              at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
              at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
              at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
              at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
              at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
              at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
              at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:555)
              at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:410)
              at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:164)
              at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
              at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
              at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
              at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
              at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
              at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
              at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
              at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
              at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
              at java.base/java.lang.Thread.run(Thread.java:829)
      Caused by: org.apache.camel.TypeConversionException: Error during type conversion from type: org.assimbly.archive.ZipInputStreamWrapper to the required type: org.apache.camel.StreamCache with value org.assimbly.archive.ZipInputStreamWrapper@3e6184af due to java.io.IOException: Stream closed
              at org.apache.camel.converter.stream.StreamCacheBulkConverterLoader.convertTo(StreamCacheBulkConverterLoader.java:60)
              at org.apache.camel.impl.converter.CoreTypeConverterRegistry.doConvertTo(CoreTypeConverterRegistry.java:462)
              at org.apache.camel.impl.converter.CoreTypeConverterRegistry.doConvertTo(CoreTypeConverterRegistry.java:358)
              at org.apache.camel.impl.converter.CoreTypeConverterRegistry.convertTo(CoreTypeConverterRegistry.java:202)
              at org.apache.camel.impl.engine.DefaultStreamCachingStrategy.cache(DefaultStreamCachingStrategy.java:222)
              at org.apache.camel.impl.engine.CamelInternalProcessor$StreamCachingAdvice.before(CamelInternalProcessor.java:929)
              ... 46 common frames omitted
      Caused by: java.io.IOException: Stream closed
              at java.base/java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:176)
              at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:342)
              at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
              at org.apache.camel.util.IOHelper.copy(IOHelper.java:193)
              at org.apache.camel.util.IOHelper.copy(IOHelper.java:161)
              at org.apache.camel.util.IOHelper.copy(IOHelper.java:156)
              at org.apache.camel.util.IOHelper.copyAndCloseInput(IOHelper.java:229)
              at org.apache.camel.util.IOHelper.copyAndCloseInput(IOHelper.java:225)
              at org.apache.camel.converter.stream.StreamCacheConverter.convertToStreamCache(StreamCacheConverter.java:54)
              at org.apache.camel.converter.stream.StreamCacheBulkConverterLoader.doConvertTo(StreamCacheBulkConverterLoader.java:78)
              at org.apache.camel.converter.stream.StreamCacheBulkConverterLoader.convertTo(StreamCacheBulkConverterLoader.java:51)
              ... 51 common frames omitted2023-11-07 17:41:41.411  WARN 1 --- [ dispatcher 447] org.elasticsearch.client.RestClient      : request [POST http://flux-es-test:9200/logs/_doc] returned 1 warnings: [299 Elasticsearch-7.17.3-5ad023604c8d7416c9eb6c0eadb62b14e766caff "Elasticsearch built-in security features are not enabled. Without authentication, your cluster could beaccessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-minimal-setup.html to enable security."]
      2023-11-07 17:41:41.420  WARN 1 --- [ dispatcher 451] org.elasticsearch.client.RestClient      : request [POST http://flux-es-test:9200/transactions/_doc] returned 1 warnings: [299 Elasticsearch-7.17.3-5ad023604c8d7416c9eb6c0eadb62b14e766caff "Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-minimal-setup.html to enable security."]
      2023-11-07 17:41:41.421 ERROR 1 --- [p1242793343-101] o.a.d.b.e.ID_6537e1053fad4b0013000109    : Failed delivery for (MessageId: A531BE75947BFB1-000000000000037E on ExchangeId: A531BE75947BFB1-000000000000037E). Exhausted after delivery attempt: 1 caught: org.apache.camel.StreamCacheException: Error during type conversion from type: org.assimbly.archive.ZipInputStreamWrapper to the required type: org.apache.camel.StreamCache with value org.assimbly.archive.ZipInputStreamWrapper@40da9800 due to org.apache.camel.TypeConversionException: Error during type conversion from type: org.assimbly.archive.ZipInputStreamWrapper to the required type: org.apache.camel.StreamCache withvalue org.assimbly.archive.ZipInputStreamWrapper@40da9800 due to java.io.IOException: Stream closed. Processed by failure processor: FatalFallbackErrorHandler[Channel[setExchangePattern76]]Message History
      ---------------------------------------------------------------------------------------------------------------------------------------
      Source                                   ID                             Processor                                          Elapsed (ms)
      xml:2                                    ID_6537e1053fad4b0013000109-6d from[direct-vm://ID_654a65bc741e4f00070007da_test_     40341210
      xml:8                                    ID_6537e1053fad4b0013000109-6d direct-vm:ID_654a65bc741e4f00070007da_test_6df7e1e            0
      xml:5                                    onException138/setExchangePatt setExchangePattern[InOnly]                                    0Exchange
      ---------------------------------------------------------------------------------------------------------------------------------------
      Exchange[
              Id                  A531BE75947BFB1-000000000000037E
              Headers             {Accept=*/*, breadcrumbId=A531BE75947BFB1-000000000000037B, CamelFileName=enrich2.txt, CamelRedelivered=false, CamelRedeliveryCounter=0, CamelServletContextPath=/regressiontests/ArchiveUnpack, Connection=close, Content-Length=1070, Content-Type=application/zip, Host=assimbly-test:9001, User-Agent=curl/7.84.0, zipFileName=enrich2.txt}
              BodyType            org.assimbly.archive.ZipInputStreamWrapper
              Body                [Body is instance of java.io.InputStream]
      ]Stacktrace
      ---------------------------------------------------------------------------------------------------------------------------------------org.apache.camel.StreamCacheException: Error during type conversion from type: org.assimbly.archive.ZipInputStreamWrapper to the required type: org.apache.camel.StreamCache with value org.assimbly.archive.ZipInputStreamWrapper@40da9800 due to org.apache.camel.TypeConversionException: Error during type conversion from type: org.assimbly.archive.ZipInputStreamWrapper to the required type: org.apache.camel.StreamCache with value org.assimbly.archive.ZipInputStreamWrapper@40da9800 due to java.io.IOException:Stream closed
              at org.apache.camel.impl.engine.CamelInternalProcessor$StreamCachingAdvice.before(CamelInternalProcessor.java:936)
              at org.apache.camel.impl.engine.CamelInternalProcessor$StreamCachingAdvice.before(CamelInternalProcessor.java:887)
              at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:335)
              at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:829)
              at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:737)
              at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:181)
              at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59)
              at org.apache.camel.processor.Pipeline.process(Pipeline.java:165)
              at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:392)
              at org.apache.camel.component.jetty.CamelContinuationServlet.doService(CamelContinuationServlet.java:245)
              at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:130)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
              at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
              at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656)
              at org.apache.camel.component.jetty.MultiPartFilter.doFilter(MultiPartFilter.java:50)
              at org.apache.camel.component.jetty.CamelFilterWrapper.doFilter(CamelFilterWrapper.java:49)
              at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
              at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
              at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
              at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
              at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
              at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
              at org.eclipse.jetty.server.Server.handle(Server.java:516)
              at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
              at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
              at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
              at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
              at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
              at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
              at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:555)
              at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:410)
              at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:164)
              at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
              at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
              at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
              at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
              at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
              at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
              at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
              at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
              at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
              at java.base/java.lang.Thread.run(Thread.java:829)
      Caused by: org.apache.camel.TypeConversionException: Error during type conversion from type: org.assimbly.archive.ZipInputStreamWrapper to the required type: org.apache.camel.StreamCache with value org.assimbly.archive.ZipInputStreamWrapper@40da9800 due to java.io.IOException: Stream closed
              at org.apache.camel.converter.stream.StreamCacheBulkConverterLoader.convertTo(StreamCacheBulkConverterLoader.java:60)
              at org.apache.camel.impl.converter.CoreTypeConverterRegistry.doConvertTo(CoreTypeConverterRegistry.java:462)
              at org.apache.camel.impl.converter.CoreTypeConverterRegistry.doConvertTo(CoreTypeConverterRegistry.java:358)
              at org.apache.camel.impl.converter.CoreTypeConverterRegistry.convertTo(CoreTypeConverterRegistry.java:202)
              at org.apache.camel.impl.engine.DefaultStreamCachingStrategy.cache(DefaultStreamCachingStrategy.java:222)
              at org.apache.camel.impl.engine.CamelInternalProcessor$StreamCachingAdvice.before(CamelInternalProcessor.java:929)
              ... 46 common frames omitted
      Caused by: java.io.IOException: Stream closed
              at java.base/java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:176)
              at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:342)
              at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
              at org.apache.camel.util.IOHelper.copy(IOHelper.java:193)
              at org.apache.camel.util.IOHelper.copy(IOHelper.java:161)
              at org.apache.camel.util.IOHelper.copy(IOHelper.java:156)
              at org.apache.camel.util.IOHelper.copyAndCloseInput(IOHelper.java:229)
              at org.apache.camel.util.IOHelper.copyAndCloseInput(IOHelper.java:225)
              at org.apache.camel.converter.stream.StreamCacheConverter.convertToStreamCache(StreamCacheConverter.java:54)
              at org.apache.camel.converter.stream.StreamCacheBulkConverterLoader.doConvertTo(StreamCacheBulkConverterLoader.java:78)
              at org.apache.camel.converter.stream.StreamCacheBulkConverterLoader.convertTo(StreamCacheBulkConverterLoader.java:51)
              

      If you need more input or testing let me know.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            skin27 Raymond
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: