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 Thorsten Schöning <ts...@am-soft.de> on 2016/03/01 09:21:19 UTC

Re: log4cxx-0.10.0 and crash on exit

Guten Tag Sean Dynan,
am Montag, 29. Februar 2016 um 19:00 schrieben Sie:

> -- I have tried statically linking to log4cxx but in that instance the
> DLL that uses log4cxx suffers the same fate.
> -- I have tried with and without APR_HAS_THREADS - no obvious change
> to the stack trace.

Did you try the patches of LOGCXX-430? I couldn't get them working for
some reason, but maybe you can.

https://issues.apache.org/jira/browse/LOGCXX-430

Additionally, simply try to uncomment the DTOR code in Hierarchy and
see if things changes. If so, this looks like another hint that the
problem is in LOGCXX-430, isn't it?

> -- log4cxx has been used in my application for years without any
> problems. Is there anything I may have introduced in my own code or
> DLL structure that might have triggered this?

Changes around multithreading, destruction order, concurrent GC
threads...? Did you change the IDE recently or recompiled using some
different settings?

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...........05151-  9468- 55
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


Re: log4cxx-0.10.0 and crash on exit

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Sean Dynan,
am Dienstag, 1. März 2016 um 19:59 schrieben Sie:

> But if it helps, I don't mind experimenting offline with the apr /
> log4cxx code to see if APR_HAS_THREADS 0 can be made to work on
> Windows. I could use some help with that compiler error though ;)

I don't see any benefit in this, if APR_HAS_THREADS is the default on
Windows anyway, we simply wouldn't want people need to change too
much away from the defaults. To me the problem is clearly around
LOGCXX-322 and -430 and those need to be fixed. And until I know how
I'm going to apply the same workaround like in aprinitializer.

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...........05151-  9468- 55
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


Re: log4cxx-0.10.0 and crash on exit

Posted by Sean Dynan <se...@gmail.com>.
On 1 March 2016 at 18:44, Thorsten Schöning <ts...@am-soft.de> wrote:
> I think I've missed you somewhere... :-) Did you rebuild with
> APR_HAS_THREADS 1 and 0 gave you errors, but is of no interest anyway,
> or are you using APR_HAS_THREADS 0 all the time, just in another way
> or how exactly are you building APR currently? If my suggested changed
> DTOR works, it looks like you are using APR_HAS_THREADS 1 now.

Yes, I am (and always was) building with APR_HAS_THREADS 1 because
that is how it is defined in apr.h by default.

When I flipped to APR_HAS_THREADS 0 and tried to rebuild, I
experienced the compiler errors in
"apr\include\arch\win32\apr_arch_file_io.h" I mentioned above.

Right now my priority is to stop our application from crashing so I
can hit a rapidly approaching deadline, so I am releasing with the
empty dtor workaround for now.

But if it helps, I don't mind experimenting offline with the apr /
log4cxx code to see if APR_HAS_THREADS 0 can be made to work on
Windows. I could use some help with that compiler error though ;)

Another thing: if APR_HAS_THREADS 0 does prevent my crashes, will that
make log4cxx less responsive? Our application cannot really tolerate a
drop in performance.


Many thanks!
-- 
Sean

Re: log4cxx-0.10.0 and crash on exit

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Sean Dynan,
am Dienstag, 1. März 2016 um 18:33 schrieben Sie:

> However, this works well:

I think I've missed you somewhere... :-) Did you rebuild with
APR_HAS_THREADS 1 and 0 gave you errors, but is of no interest anyway,
or are you using APR_HAS_THREADS 0 all the time, just in another way
or how exactly are you building APR currently? If my suggested changed
DTOR works, it looks like you are using APR_HAS_THREADS 1 now.

If it's of any value, I could provide my apr.h of 1.5.2, which
regarding my SVN is mainly a copied apr.hw with minor changes for my
Embarcadero C++ Builder.

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...........05151-  9468- 55
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


Re: log4cxx-0.10.0 and crash on exit

Posted by Sean Dynan <se...@gmail.com>.
> I thought APR defaults to multithreaded on Windowsa all the apr.h* files

You are absolutely right. apr.h is auto-generated by the build process
so, naturally, Visual Studio totally ignores it during file searches
because it iasn't officially included in a project. Outsmarted, yet
again, by Redmond.


#define APR_HAS_THREADS   0

results in compiler errors in
"apr\include\arch\win32\apr_arch_file_io.h", so I don't think I can
easily try turning off APR threads in my dev environment. Maybe
there's a patch for this too, LOL?

1>D:\workspaces\Unified_3.32_C2.5_V4.8\ADSDK\AmericanDynamicsSDK\MediaKit\3rdParty\3rd_BUILD\log4cxx\_src\apr\include\arch\win32\apr_arch_file_io.h(177):
error C2061: syntax error : identifier 'apr_thread_mutex_t'
1>D:\workspaces\Unified_3.32_C2.5_V4.8\ADSDK\AmericanDynamicsSDK\MediaKit\3rdParty\3rd_BUILD\log4cxx\_src\apr\include\arch\win32\apr_arch_file_io.h(183):
error C2059: syntax error : '}'

and so on.


However, this works well:

Hierarchy::~Hierarchy()
{
// LOGCXX-430
#ifndef APR_HAS_THREADS
     delete loggers;
     delete provisionNodes;
#endif
}

Happy :)

-- 
Sean




On 1 March 2016 at 15:47, Thorsten Schöning <ts...@am-soft.de> wrote:
> Guten Tag Sean Dynan,
> am Dienstag, 1. März 2016 um 15:54 schrieben Sie:
>
>> So I need to define APR_HAS_THREADS in my project?  I don't think it
>> is defined by default.
>
> I thought APR defaults to multithreaded on Windowsa all the apr.h*
> files I had a look at define APR_HAS_THREADS by default, so I use it
> as well. In your former message, in which you said APR_HAS_THREADS
> didn't change anything, did have APR_HAS_THREADS defined only for
> log4cxx? In that case you might want to try with APR built with
> APR_HAS_THREADS and with an unchanged ~Hierarchy first. Just to see if
> this changes things and if it does with my last suggested ~Hierarchy.
>
> 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...........05151-  9468- 55
> 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
>



-- 
Sean

Re: log4cxx-0.10.0 and crash on exit

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Sean Dynan,
am Dienstag, 1. März 2016 um 15:54 schrieben Sie:

> So I need to define APR_HAS_THREADS in my project?  I don't think it
> is defined by default.

I thought APR defaults to multithreaded on Windowsa all the apr.h*
files I had a look at define APR_HAS_THREADS by default, so I use it
as well. In your former message, in which you said APR_HAS_THREADS
didn't change anything, did have APR_HAS_THREADS defined only for
log4cxx? In that case you might want to try with APR built with
APR_HAS_THREADS and with an unchanged ~Hierarchy first. Just to see if
this changes things and if it does with my last suggested ~Hierarchy.

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...........05151-  9468- 55
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


Re: log4cxx-0.10.0 and crash on exit

Posted by Sean Dynan <se...@gmail.com>.
Will do.

So I need to define APR_HAS_THREADS in my project?  I don't think it
is defined by default.


On 1 March 2016 at 14:48, Thorsten Schöning <ts...@am-soft.de> wrote:
>> Hierarchy::~Hierarchy()
>> {
>> // LOGCXX-430
>> #ifndef APR_HAS_THREADS
>>     delete loggers;
>>     delete provisionNodes;
>> #endif
>> }


-- 
Sean

Re: log4cxx-0.10.0 and crash on exit

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Sean Dynan,
am Dienstag, 1. März 2016 um 13:37 schrieben Sie:

> Yes, the problem "goes away" when I do this:

Some light in the tunnel... :-) Could you please try again with the
following:

> Hierarchy::~Hierarchy()
> {
> // LOGCXX-430
> #ifndef APR_HAS_THREADS
>     delete loggers;
>     delete provisionNodes;
> #endif
> }

If this works as well, I apply the change to the codebase and we leak
resources here until a proper fix is available, like we already do in
aprinitializer.

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...........05151-  9468- 55
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


Re: log4cxx-0.10.0 and crash on exit

Posted by Sean Dynan <se...@gmail.com>.
> Additionally, simply try to uncomment the DTOR code in Hierarchy and
> see if things changes. If so, this looks like another hint that the
> problem is in LOGCXX-430, isn't it?

Yes, the problem "goes away" when I do this:

Hierarchy::~Hierarchy()
{
    //delete loggers;
    //delete provisionNodes;
}

which is certainly a temporary workaround for our crashes which are
actually stopping our product from shipping. :(


> Changes around multithreading, destruction order, concurrent GC
> threads...? Did you change the IDE recently or recompiled using some
> different settings?

It is hard to say. There is a team here working on the overall
product, some involved in the C++ stack, some involved in the C# GUI.
The C++ binaries are all built with the same C++ run times, including
all our 3rd party code, to make sure we don't fall foul of mismatched
CRTs. So I think this problem has been in our code base for a long
time just waiting to happen, and we only noticed it recently because
crashes are pretty obvious.

-- 
Sean





On 1 March 2016 at 08:21, Thorsten Schöning <ts...@am-soft.de> wrote:
> Guten Tag Sean Dynan,
> am Montag, 29. Februar 2016 um 19:00 schrieben Sie:
>
>> -- I have tried statically linking to log4cxx but in that instance the
>> DLL that uses log4cxx suffers the same fate.
>> -- I have tried with and without APR_HAS_THREADS - no obvious change
>> to the stack trace.
>
> Did you try the patches of LOGCXX-430? I couldn't get them working for
> some reason, but maybe you can.
>
> https://issues.apache.org/jira/browse/LOGCXX-430
>
> Additionally, simply try to uncomment the DTOR code in Hierarchy and
> see if things changes. If so, this looks like another hint that the
> problem is in LOGCXX-430, isn't it?
>
>> -- log4cxx has been used in my application for years without any
>> problems. Is there anything I may have introduced in my own code or
>> DLL structure that might have triggered this?
>
> Changes around multithreading, destruction order, concurrent GC
> threads...? Did you change the IDE recently or recompiled using some
> different settings?
>
> 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...........05151-  9468- 55
> 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
>



-- 
Sean