[ 
https://issues.apache.org/jira/browse/LOGCXX-532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17467538#comment-17467538
 ] 

Stephen Webb commented on LOGCXX-532:
-------------------------------------

Running multithreadtest repeatedly eventually causes a SegFault. The core dump 
shows

```

(gdb) info threads
  Id   Target Id                         Frame
* 1    Thread 0x7fb59ece7700 (LWP 53546) 0x00007fb5a050d9f6 in 
__run_exit_handlers (status=0, listp=0x7fb5a06af718 <__exit_funcs>, 
run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true)    
at exit.c:77
  2    Thread 0x7fb597fff700 (LWP 53547) 0x00007fb5a050da78 in 
__run_exit_handlers (status=0, listp=0x7fb5a06af718 <__exit_funcs>, 
run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true)    
at exit.c:112
  3    Thread 0x7fb59e4e6700 (LWP 53548) 0x000055fb4d703c8b in int 
std::uniform_int_distribution<int>::operator()<std::mersenne_twister_engine<unsigned
 long, 32ul, 624ul, 397ul, 31ul, 2567483615ul, 11ul, 4294967295ul, 7ul, 
2636928640ul, 15ul, 4022730752ul, 18ul, 1812433253ul> 
>(std::mersenne_twister_engine<unsigned long, 32ul, 624ul, 397ul, 31ul, 
2567483615ul, 11ul, 4294967295ul, 7ul, 2636928640ul, 15ul, 4022730752ul, 18ul, 
1812433253ul>&, std::uniform_int_distribution<int>::param_type const&) ()
  4    Thread 0x7fb59f4e8700 (LWP 53545) 0x00007fb5a0bae454 in 
std::_Tuple_impl<0ul, log4cxx::Logger::LoggerPrivate*, 
std::default_delete<log4cxx::Logger::LoggerPrivate> 
>::_M_head(std::_Tuple_impl<0ul, log4cxx::Logger::LoggerPrivate*, 
std::default_delete<log4cxx::Logger::LoggerPrivate> > const&)@plt () from 
/home/stephen/build/log4cxx_gmail/src/main/cpp/liblog4cxx.so.12  5    Thread 
0x7fb59dce5700 (LWP 53549) 0x00007fb5a0c3b415 in 
log4cxx::Logger::isInfoEnabled() const () from 
/home/stephen/build/log4cxx_gmail/src/main/cpp/liblog4cxx.so.12
  6    Thread 0x7fb59d4e4700 (LWP 53550) 0x00007fb5a050d9f6 in 
__run_exit_handlers (status=0, listp=0x7fb5a06af718 <__exit_funcs>, 
run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true)    
at exit.c:77
  7    Thread 0x7fb5a02c9c80 (LWP 53544) __pthread_clockjoin_ex 
(threadid=140418038531840, thread_return=0x0, clockid=<optimised out>, 
abstime=<optimised out>, block=<optimised out>)    at pthread_join_common.c:145

```

 

> Static objects and deleting
> ---------------------------
>
>                 Key: LOGCXX-532
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-532
>             Project: Log4cxx
>          Issue Type: Improvement
>            Reporter: Robert Middleton
>            Assignee: Robert Middleton
>            Priority: Minor
>
> As seen in LOGCXX-430 and LOGCXX-322, making sure that when an application 
> terminates earlier than expected we don't crash is rather hard to do.
> I came across this solution when researching this problem:
> https://stackoverflow.com/a/470545/624483
> My thought is that we create something like a log4cxx::Globals class, which 
> contains a smart pointer to everything that must be kept alive before the 
> library can safely be unloaded.  In each thread, you would do something like:
> {{GlobalsPtr globals = log4cxx::globals;}}
> thus ensuring that the destructor can't run before all of the threads are 
> stopped.  This would be up to the user of the library.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to