Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6860

ProductionModeClasspathFile might cause IOException when used with Jetty9

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Neutral
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.4.10, 5.5.1
    • Component/s: None
    • Labels:
      None
    • Sprint:
      Basel 71
    • Story Points:
      2
    • Magnolia Release:
      5.4.10, 5.5.1

      Description

      Since the refactoring of info.magnolia.resourceloader.classpath.service.impl.production.ProductionModeClasspathFile (see MAGNOLIA-6781; https://git.magnolia-cms.com/projects/PLATFORM/repos/main/commits/7880f8d504836fa5e62419af5e3c662a02a1b45f) we cannot run our integration tests with Jetty 9 anymore, due to errors while crawling the pages. On a regular basis will Jetty 9 complain about:

      [INFO] [talledLocalContainer] Caused by: java.io.IOException: Stream closed
      [INFO] [talledLocalContainer]   at java.util.zip.InflaterInputStream.ensureOpen(InflaterInputStream.java:67)
      [INFO] [talledLocalContainer]   at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:142)
      [INFO] [talledLocalContainer]   at java.io.FilterInputStream.read(FilterInputStream.java:133)
      [INFO] [talledLocalContainer]   at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
      [INFO] [talledLocalContainer]   at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
      [INFO] [talledLocalContainer]   at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
      [INFO] [talledLocalContainer]   at java.io.InputStreamReader.read(InputStreamReader.java:184)
      [INFO] [talledLocalContainer]   at java.io.BufferedReader.fill(BufferedReader.java:161)
      [INFO] [talledLocalContainer]   at java.io.BufferedReader.read1(BufferedReader.java:212)
      [INFO] [talledLocalContainer]   at java.io.BufferedReader.read(BufferedReader.java:286)
      [INFO] [talledLocalContainer]   at freemarker.template.Template$LineTableBuilder.read(Template.java:844)
      [INFO] [talledLocalContainer]   at freemarker.core.SimpleCharStream.FillBuff(SimpleCharStream.java:116)
      [INFO] [talledLocalContainer]   at freemarker.core.SimpleCharStream.readChar(SimpleCharStream.java:198)
      [INFO] [talledLocalContainer]   at freemarker.core.SimpleCharStream.BeginToken(SimpleCharStream.java:138)
      [INFO] [talledLocalContainer]   at freemarker.core.FMParserTokenManager.getNextToken(FMParserTokenManager.java:7446)
      [INFO] [talledLocalContainer]   at freemarker.core.FMParser.jj_ntk_f(FMParser.java:6271)
      [INFO] [talledLocalContainer]   at freemarker.core.FMParser.PCData(FMParser.java:3503)
      [INFO] [talledLocalContainer]   at freemarker.core.FMParser.MixedContentElements(FMParser.java:3643)
      [INFO] [talledLocalContainer]   at freemarker.core.FMParser.Root(FMParser.java:4280)
      [INFO] [talledLocalContainer]   at freemarker.template.Template.<init>(Template.java:254)
      [INFO] [talledLocalContainer]   at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:548)
      [INFO] [talledLocalContainer]   at freemarker.cache.TemplateCache.getTemplateInternal(TemplateCache.java:438)
      [INFO] [talledLocalContainer]   at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:291)
      [INFO] [talledLocalContainer]   at freemarker.template.Configuration.getTemplate(Configuration.java:2438)
      [INFO] [talledLocalContainer]   at freemarker.template.Configuration.getTemplate(Configuration.java:2296)
      [INFO] [talledLocalContainer]   at info.magnolia.freemarker.FreemarkerHelper.render(FreemarkerHelper.java:167)
      [INFO] [talledLocalContainer]   at info.magnolia.rendering.renderer.FreemarkerRenderer.onRender(FreemarkerRenderer.java:95)
      

      (see full log attached: jetty9-log-statement.log)

      This is due to Jetty 9's default classpath resource caching, see org.eclipse.jetty.util.resource.Resource.

      Not closing the url connection when acquiring the last modification date solves the problem but is not an appropriate solution.
      Instead we should set the default caching to false for Jetty only (see patch attached MAGNOLIA-6860.patch; successfully executed integration tests with Jetty 9).

      Even though we have explicitly turned off caching in Tomcat 8 too (see MGNLCE-59; https://git.magnolia-cms.com/projects/PLATFORM/repos/ce/commits/f9a5b2d387f60069166deb3706d8ca11ce8f6eeb) we should make sure this has no impact on Tomcat and its performance.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                apchelintcev Aleksandr Pchelintcev
                Reporter:
                pmundt Philip Mundt
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: