6 Replies Latest reply on Oct 31, 2002 12:19 PM by waiken

    JBOSS/Jetty hits open files limit for JSPs

    chrismay

      I'm using JBOSS/3.0.3 + Jetty for a web application that has a JSP which is recursively included into itself to build up a hierarchical list - typically with about 20-50 elements.

      My problem is that, under load (Production environment is Solaris), JBOSS crashes because it runs out of open file handles. Looking at the output of 'lsof', I can see that there are many many ( i.e, hundreds of) open files for the recursively included JSP.
      It looks as if every "include" for every request being handled at one time, is keeping a file handle - so with 10 concurrent requests we're up to the 4096 open files limit.

      Question - why is Jetty trying to open these files at all? Surely once it's compiled the classes, it should not need to go back to the JSP files at all - if it does, then it only needs to do a "select" not an "open", to check the modification date.

      Can anyone help ?

      TIA

      Chris

        • 1. Re: JBOSS/Jetty hits open files limit for JSPs


          I think that this has something to do with Jasper (the Jakarta JSP engine used by Jetty) and the JBoss ClassLoader.

          Jasper will be watching the JSP files in case they change, in which case it needs to recompile them.

          Has anyone seen anything like this on Tomcat ?

          Jules

          • 2. Re: JBOSS/Jetty hits open files limit for JSPs
            waiken

            I have seen the same thing using Tomcat 4.1.12 with JBoss 3.0.3 on RedHat Linux 7.3. I didnt have a recursive include, but a simple JSP that includes a header, footer and menu (all static stuff).

            Jules suggested that I switch the Jasper 2 jar for the Jasper 1 jar and see if that helps. I havent had time to try it yet...but still anxious to do so.

            my original post on this:

            http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/

            • 3. Re: JBOSS/Jetty hits open files limit for JSPs

              I should have mentioned and probably did on the other thread that you should be precompiling your JSPs anyway.

              On the fly compilation is a useful development feature, but not the sort of stuff that you want in production.

              I would be surprised if a precompiled webapp suffered the same problems....

              You wouldn't ship your servlets into prod as javasrc and compile them on the fly - would you ?

              so why ship your front end as JSPs, then, on-the-fly compile them to java and then compile that to servlets ?

              There is some stuff on precompilation in my JBoss/Jetty FAQ which is posted periodically on this forum. It uses JspC which comes with Jasper.

              Jules

              • 4. Re: JBOSS/Jetty hits open files limit for JSPs
                waiken

                Jules

                The problem doesnt seem to occur on the first hit, but after the "pre-compiled" servlets have been hit a number of times.

                Why would pre-compiling help this? It would make sense if the JSPS' were being compiled each time, but they are only compiled once...after that, its just the same as them being precompiled.

                Are you suggesting that the one-time compilation of the JSP's is causing this havoc?

                Thanks

                • 5. Re: JBOSS/Jetty hits open files limit for JSPs

                  The first time they are hit Jetty has to make up a huge JSP classpath to pass to Jasper. This will result in many jars being opened and read.

                  Subsequent hits will result in Jasper checking the date on the JSP against the date on the class file, in case it needs to recompile it.

                  Precompiling your JSPs and only delivering servlets to production would prevent either of these things from occurring there.

                  Chances are that one or both of these is directly responsible for your problem.


                  Jules

                  • 6. Re: JBOSS/Jetty hits open files limit for JSPs
                    waiken

                    Thanks for the explanation, that does make sense now.

                    Although Im still concerned what to do in development if I do want to take advantage of on the fly compilation. Ill stick with Jasper 1 for now since it hasnt caused the same problem...

                    Thanks again