You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Thorsten Schöning <ts...@am-soft.de> on 2010/10/15 12:14:28 UTC

apr_terminate called too early...

Hello,

I have a GUI-application in Borland C++-Builder 5 which I needed to
add logging support using log4cxx. It started fine but I noticed
problems after closing the application. Like others on the net I have
the problem that the application crashes during accessing or deleting
some mutexes during destruction of different objects. Because I didn't
find a real solution or advice what might be the problem, just some
infos on locking problems or stuff like that, I tried to look into
this myself.

What I have found is that apr_terminate is called during
deconstruction of APRInitializer before the access problems or
exceptions occur. This makes sense, because the problem was that some
apr-mutexes where inaccessible in some point during application
shutdown and all those mutexes are owned by apr, if I understood
correctly.

From my point of view I would have expected that apr_terminate is the
last thing called in Log4cxx but it seems that after deconstruction of
APRInitializer and apr_terminate deconstructing objects just continues
with some Loggers, Appenders etc. All of them use mutexes which aren't
available anymore if apr_terminate was called before.

It does seem that theres only one instance of APRInitializer available
during runtime and that apr_initiliaze is called only once, therefore
the one call of apr_terminate I noticed really kills all objects and
memory. I didn't understand how and when APRInitializer is
deconstructed, though.

So, can it be correct that apr_terminate is called before everything
else has finished and all Objects using apr-mutexes released them
properly? If I uncomment apr_terminate, the application seems to
finish properly.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning
AM-SoFT IT-Systeme - Hameln | Potsdam | Leipzig
 
Telefon: Potsdam: 0331-743881-0
E-Mail:  tschoening@am-soft.de
Web:     http://www.am-soft.de

AM-SoFT GmbH IT-Systeme, Konsumhof 1-5, 14482 Potsdam
Amtsgericht Potsdam HRB 21278 P, Geschäftsführer: Andreas Muchow