- 19 Nov 2007 -

I made a second crucial memory leak discovery on Friday. Apparently, the default JSP compiler for Tomcat, Jasper, has a “bug” that doesn’t free memory with objects used in a ForEach or Set taglib (found via the always helpful webapp memory leak page).

Both of these tags are used judiciously on the patient dashboard and other pages throughout OpenMRS. As the day progressed, the 40+ users we have in Eldoret would gradually visit more and more pages with different data displayed. The foreach tags that looped over the encounters, obs, patients, etc, wouldn’t release those objects. Eventually, enough of our database would be kept in Tomcat’s memory to cause an Out of Memory (OOM) error — usually just manifesting as a confusing PermGen error in the log files.

The fix outlined on that tomcat bug report page is actually quite simple. We simply have to tell tomcat not to “pool” taglibs and magically the memory leak is gone. In <TOMCAT HOME>/conf/web.xml file, in the jsp servlet definition add the following element:

<init-param>
<param-name>enablePooling</param-name>
<param-value>false</param-value>
</init-param>

After changing this, OpenMRS has successfully been up for a full day of data entry for the first time in a few months!

If your installation of OpenMRS seems unstable or slows down after a few hours of use, I would suggest trying this fix. The memory/cpu trade-off that occurs from not having taglib pooling is definitely in your favor.

I’m beginning to feel like a paid blogger for yourkit, but I really must thank YourKit again for the their license donations. Their newest 7.0 release helped me track down the source of this latest bug with relative ease.

This is in the openmrs category tagged as ,

3 comments »


The PIH developers used to have a daily tradition of sharing what new features and special tricks they found in Eclipse. I’ve had many such moments myself, albeit not nearly a daily thing…

Today, the thing I love about Eclipse is the abundance of plugins.  I sat here thinking, I wish I could control-click on an interface method and jump to the implementation of that interface.  The first hit in my google search gave me a plugin to install.  Now, instead of doing any silly looking for the Hibernate implementation of the ContextDAO, I can right-click on a method call, select “Open Implementation”, and boom, I’m looking at the HibernateContextDAO class.

You can find the implementation plugin described here http://eclipse-tools.sourceforge.net/implementors and the eclipse update site link is: http://eclipse-tools.sourceforge.net/updates/ .

The other very helpful plugins I have installed are:

  • Subclipse – http://subclipse.tigris.org/update_1.2.x
  • FindBugs – http://findbugs.cs.umd.edu/eclipse
  • FreeMem – http://www.junginger.biz/eclipse/

In addition, because I upgraded to Eclipse 3.3.1.1 (that last .1 is very important), I get built in jsp syntax highlighting.

This is in the babble category tagged as

1 comment »

- 05 Nov 2007 -

Several times per year there is a true test of the OpenMRS collaboration. Those of us that work for Regenstrief are here in Indianapolis. The developers that work for PIH are in Boston. Last night, the New England Patriots beat the Indianapolis Colts. We usually have a nice friendly bet with the Boston guys over whose team will win. This time the bet was dinner — if the Colts win we buy them dinner and vice versa. Last week I had picked out a nice $40 a plate eatery for their next visit with the knowledge that the Colts would prevail.

Now I’m thinking Taco Bell.

This is in the babble, openmrs category tagged as

3 comments »