2 Replies Latest reply on Nov 18, 2016 8:24 PM by cfang

    Too many open File Descriptors when using XMLItemReader

    krzysztofwach

      Hi

       

      We observe too many open File Descriptors on the server.

      We use jberet-support 1.2.0.Final XMLItemReader to parse XML file in 10 threads.

       

      During the job at one of the latest step we remove this file.

      We observe that there appear 10 open descriptors left open even that the file is removed.

       

      Is it a known issue? Or we need some changes in the configuration

       

      Please let me know if you need any further details

        • 1. Re: Too many open File Descriptors when using XMLItemReader
          cfang

          xmlItemReader uses jackson-dataformat-xml for parsing.  The reader's close() method closes the jackson xml parser:

           

          jsr352/XmlItemReader.java at master · jberet/jsr352 · GitHub

           

          but jackson xml parser may think the caller owns the stream and so chooses not to close the underlying stream.

           

          I've just created the following JBeret issue:

          1. JBERET-282

          Too many open File Descriptors when using XMLItemReader

          • 2. Re: Too many open File Descriptors when using XMLItemReader
            cfang

            What's your setup (OS and Java versions, Jackson version? etc)?  What's the output that shows file descriptors not released (e.g., lsof output)?

             

            I tried my test but couldn't reproduce the problem (with Java 7, jackson-dataformat-xml:jar:2.5.4, jberet-support:jar:1.3.0.Beta4-SNAPSHOT).

            xmlItemReader has not changed since jberet-support 1.2.0.Final.

             

            I set a breakpoint at the line before fromXmlParser.close:

             

            public void close() throws Exception {

                    if (fromXmlParser != null) {

                        SupportLogger.LOGGER.closingResource(resource, this.getClass());

                        fromXmlParser.close();

                        fromXmlParser = null;

                    }

                }

             

            lsof shows the open file of movies-2012.xml.

             

            java      27885 cfang  152r      REG                1,7      12833 16410439 /Users/cfang/dev/jsr352/jberet-support/target/test-classes/movies-2012.xml

             

            And once the debugger got past fromXmlParser.close() calls, lsof no longers shows movies-2012.xml file, which means the input resource has been closed.