Facelets bug

I was stress testing a web application that’s built on JSF and Facelets and after navigating between several pages quickly I consistently got errors saying ‘Too many open files’. A quick look at the output of lsof revealed that one particular jar file was kept open hundreds of times. This jar file contains facelets components and templates, as wel as resources like images, css and javascript, which I then load in my web application with the help of weblets.

Now knowing where to look, I started googling and quickly found some posts on the facelets mailing list reporting the same behaviour. A little more digging eventually led me to a bug report: https://facelets.dev.java.net/issues/show_bug.cgi?id=254. Unfortunately, there is no production version of Facelets available where this is fixed. However, someone suggested a workaround. Just put the following context parameter in your web.xml and the problem disappears:

<context-param>
  <param-name>facelets.REFRESH_PERIOD</param-name>
  <param-value>-1</param-value>
</context-param>

This tells facelets not to scan the compositions for updates, which avoids keeping the jar-file open. You do loose the convenience of live page updates when using the maven Jetty plugin, but at least your web application will no longer crash after a few minutes, which is rather nice I think :)

I should note that when version 1.1.15 comes out, this bug should be fixed.

Reacties op “Facelets bug”

Er zijn nog geen reacties op dit artikel.

Reageer