velocity.log files leaking until "Too many open files" errors

Solution Unverified - Updated

Environment

  • Java
  • JBoss Enterprise Application Platform (EAP)

Issue

  • We use Apache Velocity in our Java/JBoss application. File handles for velocity.log continue to leak and build up until we hit our file limit and see errors like the following:
java.io.FileNotFoundException: /var/lib/jbossas/bin/velocity.log (Too many open files)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
	at org.apache.log.output.io.FileTarget.openFile(FileTarget.java:106)
	at org.apache.log.output.io.FileTarget.<init>(FileTarget.java:55)
	at org.apache.velocity.runtime.log.AvalonLogChute.initTarget(AvalonLogChute.java:109)
	at org.apache.velocity.runtime.log.AvalonLogChute.init(AvalonLogChute.java:88)
	at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:150)
	at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:208)
	at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:728)
	at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:240)
	at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:116)

Resolution

  • Upgrade the velocity library to 1.5+

Root Cause

Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.