[Ace-users] [ace-users] [ACE_Base_Thread_Adapter]: Crash in inherit_log_msg()

Steve Gury steve.gury at gmail.com
Thu Jan 17 12:06:27 CST 2008


ACE VERSION: 5.5

HOST MACHINE and OPERATING SYSTEM:
Windows XP 32 bits SP2, Winsock2

TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
 COMPILER NAME AND VERSION (AND PATCHLEVEL):
Windows XP 32 bits SP2, Winsock2, Visual Studio 2005 SP1

THE $ACE_ROOT/ace/config.h FILE
#define _WINSOCKAPI_		1
#define ACE_HAS_WINSOCK2	1
#define ACE_SVC_HAS_DLL 1
#define ACE_HAS_STRDUP_EMULATION
#define ACE_HAS_WCSDUP_EMULATION
#define ACE_USE_ONE_SHOT_AT_THREAD_EXIT 1
#define ACE_NLOGGING    1
#define ACE_THREADS_DONT_INHERIT_LOG_MSG    1
#define ACE_HAS_LOG_MSG_NT_EVENT_LOG    1
#define ACE_THREAD_MANAGER_USES_SAFE_SPAWN  1
#define ACE_HAS_TSS_EMULATION   1
#include "ace/config-win32.h"

THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE:

CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features

 AREA/CLASS/EXAMPLE AFFECTED:
ACE_Base_Thread_Adapter::inherit_log_msg() crash

DOES THE PROBLEM AFFECT:
 COMPILATION?
 LINKING?
 On Unix systems, did you run make realclean first?
 EXECUTION?
 OTHER (please specify)?
Crash during execution

 SYNOPSIS:
I've disable ACE Log (as you can see in the config.h) by defining
ACE_NLOGGING and ACE_THREADS_DONT_INHERIT_LOG_MSG, but when starting
another thread with ACE, the thread crashs during initialization.

 DESCRIPTION:
The crash appears in ACE_Base_Thread_Adapter::inherit_log_msg (void)
because inherit_log_msg_hook_ is not NULL. This hook has been set
during ACE_Log_Msg construction, however I've disable ACE_Log_Msg
usage with ACE_NLOGGING !!! So I think the best solution is to disable
completely ACE_Log_Msg construction during Object_Manager::init(). I
haven't found any problems with this approach, maybe somebody can
confirm this?

 REPEAT BY:
[What you did to get the error; include test program or session
transcript if at all possible. ] Sorry, but this is not possible.

 SAMPLE FIX/WORKAROUND:
In Object_Manager.cpp at init() function, surround ACE_Log_Msg
initialization with NLOGGING check.

#       if !defined (ACE_NLOGGING)
          // Open the main thread's ACE_Log_Msg.
          if (0 == ACE_LOG_MSG)
            return -1;
#       endif

It seems to work for me.



More information about the Ace-users mailing list