Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7186

Resource Leak in GroovyScriptEngine

    XMLWordPrintableJSON

    Details

      Description

      When recompiling dependencies in a script, in certain cases files are not closed.

      In GroovyScriptEngine.createCompilationUnit getResourceConnection is called which opens a stream but will never be closed.
      Discovered in 2.1.9, still there in 2.3.7.

      for (String depSourcePath : cache.get(".")) {
      try

      { cache.get(depSourcePath); cu.addSource(getResourceConnection(depSourcePath).getURL()); }

      catch (ResourceException e)

      { /* ignore */ }

      }

      Stack trace in our unit tests showing the problem:
      sun.net.www.protocol.file.FileURLConnection.getInputStream()
      groovy.util.GroovyScriptEngine.getResourceConnection(String)
      groovy.util.GroovyScriptEngine$ScriptClassLoader.createCompilationUnit(CompilerConfiguration, CodeSource)
      groovy.lang.GroovyClassLoader.parseClass(GroovyCodeSource, boolean)
      groovy.util.GroovyScriptEngine$ScriptClassLoader.doParseClass(GroovyCodeSource)
      groovy.util.GroovyScriptEngine$ScriptClassLoader.parseClass(GroovyCodeSource, boolean)
      groovy.lang.GroovyClassLoader.parseClass(String, String)
      groovy.util.GroovyScriptEngine.loadScriptByName(String)
      groovy.util.GroovyScriptEngine.createScript(String, Binding)
      groovy.util.GroovyScriptEngine.run(String, Binding)
      de.metus.scripting.groovy.GroovyScriptEngineWrapper.run(URI, String, Map)

        Attachments

          Activity

            People

            • Assignee:
              blackdrag Jochen Theodorou
              Reporter:
              mvmsoft Marco van Meegen
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: