You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by Bjørn-Harald Thirud <bj...@gmail.com> on 2012/09/14 17:33:12 UTC
Resource leak in APRInitializer
Hello all,
Class APRInitializer appears to have a resource leak. Towards the end, the
ctor has this block:
#if APR_HAS_THREADS
apr_status_t stat = apr_threadkey_private_create(&tlsKey, tlsDestruct,
p);
assert(stat == APR_SUCCESS);
#endif
But there is no matching code in the destructor. Our fix was to add this
block to the beginning of APRInitializer's dtor:
#if APR_HAS_THREADS
apr_threadkey_private_delete(tlsKey);
#endif
This causes problems when log4cxx is used in a dll/so which is
loaded/unloaded many times over the process life-cycle, such as a COM
object or native java class.
I understand log4cxx is no longer actively maintained, but I still thought
I mention it on this list in case somebody wants to pick it up. I won't do
more about it as we will most likely move away from log4cxx soon.
Kind Regards
Bjorn Thirud
Re: Resource leak in APRInitializer
Posted by Bjørn-Harald Thirud <bj...@gmail.com>.
On 17 September 2012 12:29, Christian Grobmeier <gr...@apache.org> wrote:
> Hello all,
>
> I have commit rights to log4cxx, but I am not a c++ developer. If you
> can provide patches for the mentioned bugs below, I might be able to
> apply them. I am just not able to test what I have done and need
> either good instructions or your help testing. So if you want to give
> it a try, lets me know.
>
This is the patch for APRInitializer.
I'm obviously not in the best position to decide if the patch should be applied.
Kind Regards
Bjorn Thirud
Re: Resource leak in APRInitializer
Posted by Christian Grobmeier <gr...@apache.org>.
Hello all,
I have commit rights to log4cxx, but I am not a c++ developer. If you
can provide patches for the mentioned bugs below, I might be able to
apply them. I am just not able to test what I have done and need
either good instructions or your help testing. So if you want to give
it a try, lets me know.
Best regards,
Christian
On Mon, Sep 17, 2012 at 12:23 PM, Bjørn-Harald Thirud
<bj...@gmail.com> wrote:
> Hei Thorsten Schöning,
>
> 2012/9/14 Thorsten Schöning <ts...@am-soft.de>
>> am Freitag, 14. September 2012 um 17:33 schrieben Sie:
>>
>> > I won't do
>> > more about it as we will most likely move away from log4cxx soon.
>>
>> What's the alternative you decided for and why? I need to consider a
>> move as well in the future.
>
> We have experimented with log4cxx in COM objects which are called from
> a PHP web site. Our conclusion from that experiment is that log4cxx is
> designed to be initialized once during process startup, which we can't
> easily do. The bug in APRInitializer is one thing, but there are other
> clues as well, e.g. singleton instantiations that aren't thread safe.
>
> The COM objects have proprietary logging functions we tried to get rid
> of, so for now we'll just switch back to those.
>
> I'd like to add that log4cxx has served us well for years in some
> high-availability systems where the last thing you want is a service
> degradation due to a faulty logging library. Currently, we have no
> plans to replace log4cxx there.
>
>
> Kind Regards
> Bjørn Thirud
--
http://www.grobmeier.de
https://www.timeandbill.de
Re: Resource leak in APRInitializer
Posted by Bjørn-Harald Thirud <bj...@gmail.com>.
Hei Thorsten Schöning,
2012/9/14 Thorsten Schöning <ts...@am-soft.de>
> am Freitag, 14. September 2012 um 17:33 schrieben Sie:
>
> > I won't do
> > more about it as we will most likely move away from log4cxx soon.
>
> What's the alternative you decided for and why? I need to consider a
> move as well in the future.
We have experimented with log4cxx in COM objects which are called from
a PHP web site. Our conclusion from that experiment is that log4cxx is
designed to be initialized once during process startup, which we can't
easily do. The bug in APRInitializer is one thing, but there are other
clues as well, e.g. singleton instantiations that aren't thread safe.
The COM objects have proprietary logging functions we tried to get rid
of, so for now we'll just switch back to those.
I'd like to add that log4cxx has served us well for years in some
high-availability systems where the last thing you want is a service
degradation due to a faulty logging library. Currently, we have no
plans to replace log4cxx there.
Kind Regards
Bjørn Thirud
Re: Resource leak in APRInitializer
Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Bjørn-Harald Thirud,
am Freitag, 14. September 2012 um 17:33 schrieben Sie:
> I won't do
> more about it as we will most likely move away from log4cxx soon.
What's the alternative you decided for and why? I need to consider a
move as well in the future.
Mit freundlichen Grüßen,
Thorsten Schöning
--
Thorsten Schöning E-Mail:Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon.............030-2 1001-310
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow