From: Robert J. <yad...@sn...> - 2007-02-28 16:10:54
|
I posted this problem in August last year, but I never got a solution... I'm getting some errors when use the Synchronized appender. My "real" program inits Log4Perl, then forks one or more children to do the work. The parent then just monitors the children (like a good parent does, right? :) ). I have a SIGTERM handler defined in the parent. When I SIGTERM the parent, I get a bunch of errors (shown below) for removal of the semaphore. I'm guessing that one process removes the semaphore before the others are done with it. Perhaps IPC::Shareable is calling DESTROY multiple times (one for each process using that semaphore?) Below is a simple test case which generates the semaphore errors. The errors only occur both of the following are true: 1) using the Synchronized appender, and 2) a SIGTERM handler is defined To reproduce the problem, start *at least 2* instances of the program below in the background, then kill all instances. When I do so, I see these errors: Couldn't remove semaphore set 23789588: Identifier removed at source.pl line 0 Couldn't remove shared memory segment 23789588: Invalid argument at source.pl line 0 Thanks for your help! --------------------------------------------------- #!/usr/bin/perl use strict; use Log::Log4perl qw(get_logger :levels); $SIG{'TERM'} = \&quit; sub quit; #Initialize logger Log::Log4perl->init(\q{ log4perl.rootLogger = DEBUG, SyncScreen log4perl.appender.Screen = Log::Log4perl::Appender::Screen log4perl.appender.Screen.layout = Log::Log4perl::Layout::SimpleLayout log4perl.appender.SyncScreen = Log::Log4perl::Appender::Synchronized log4perl.appender.SyncScreen.appender = Screen }); my $logger = get_logger(); $logger->info("Starting....."); while (1) { sleep (30); } sub quit { exit (); } -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Robert Jacobson .......................... Flight Ops. Team Solar Dynamics Observatory (SDO) ............. .............. |