Bug found with logging

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug found with logging

Álvaro Alda
This post was updated on .
Hi everyone!

On my company we have two instances of Fuse/Servicemix 4.3.0 (which uses Karaf 2.0.0) with a Master/Slave failover configuration. Specifically, we use the simple lock file mechanism. The logging system is configured with a RollingFileAppender. After several days without restarting the servers, we noticed that the hard drive partition was getting strangely full. With "lsof | grep deleted" command we have realized that there is a servicemix.log.10 ghost file that is growing continuously. If you start two instances with this configuration and use the "lsof" tool, you will realize that the same java process opens two file descriptors of the same log file. One of them rolls until the file system tries to remove it.

I have searched in the source code of Karaf and found the problem. The method getDefaultHandler() in class org.apache.karaf.main.BootstrapLogManager is being invoked twice, one time in org.apache.karaf.main.Main and another one in org.apache.karaf.main.SimpleFileLock class (or DefaultJDBCLock). But it seems that the singleton pattern isn't implemented well because everytime this method is called, a new object instance of the Handler class is created without closing the previous instance. The close() method must be called in order to release the output stream correctly.

I have checked that this problem persists through all releases of Karaf, including latest one.

Regards
Álvaro
Reply | Threaded
Open this post in threaded view
|

Re: Bug found with logging

Achim Nierbeck
Do you mind opening an issue for this, 
and since you already found a solution for it to attach a patch to it?

Regards, Achim 

2011/11/29 Álvaro Alda <[hidden email]>
Hi everyone!

On my company we have two instances of Fuse/Servicemix 4.3.0 (which uses
Karaf 2.0.0) with a Master/Slave failover configuration. Specifically, we
use the simple lock file mechanism. The logging system is configured with a
/RollingFileAppender/. After several days without restarting the servers, we
noticed that the hard drive partition was getting strangely full. With
/"lsof | grep deleted"/ command we have realized that there is a
servicemix.log.10 ghost file that is growing continuously. If you start two
instances with this configuration and use the /"lsof"/ tool, you will
realize that the same java process opens two file descriptors of the same
log file. One of them rolls until the file system tries to remove it.

I have searched in the source code of Karaf and found the problem. The
method getDefaultHandler() in class
/org.apache.karaf.main.BootstrapLogManager/ is been invoked twice, one time
in org.apache.karaf.main.Main and another one in
/org.apache.karaf.main.SimpleFileLock/ class (or /DefaultJDBCLock/). But it
seems that the singleton pattern isn't implemented well because everytime
this method is called, a new object instance of the /Handler/ class is
created without closing the previous instance. The close() method must be
called in order to release the output stream correctly.

I have checked that this problem persists through all releases of Karaf,
including latest one.

Regards
Álvaro

--
View this message in context: http://karaf.922171.n3.nabble.com/Bug-found-with-logging-tp3545618p3545618.html
Sent from the Karaf - User mailing list archive at Nabble.com.



--

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Reply | Threaded
Open this post in threaded view
|

Re: Bug found with logging

Álvaro Alda