Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Log-Dispatch CPAN distribution.

Report information
The Basics
Id: 85013
Status: resolved
Priority: 0/
Queue: Log-Dispatch

People
Owner: Nobody in particular
Requestors: cedric.carree [...] mancalanetworks.com
fry [...] open.ch
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 2.35
  • 2.36
  • 2.37
  • 2.38
  • 2.39
Fixed in: 2.42



Subject: Log::Dispatch::Syslog isn't thread-safe
Date: Fri, 6 May 2011 14:36:06 +0200 (CEST)
To: bug-Log-Dispatch [...] rt.cpan.org
From: Cedric Carree <cedric.carree [...] mancalanetworks.com>
Download (untitled) / with headers
text/plain 9.2k
Hi. Using Perl 5.6.0 threads, the Log::Dispatch::Syslog may SEGV. This is maybe a bug on Sys::Syslog rather than Log::Dispatch::Syslog I think this is because Sys::Syslog tries to open and/or close twice the connection to syslog (in two differents threads). Here are the traces I got running my test script (attached) cedric.carree@me:~$ perl syslog-thread.pl Attempt to free unreferenced scalar: SV 0x916ed78, Perl interpreter: 0x8eb2c68 at /usr/share/perl5/Log/Dispatch/Output.pm line 34. Thread 3 terminated abnormally: The following parameter was passed in the call to Log::Dispatch::Output::log but was not listed in the validation options: log4p_level at /usr/share/perl5/Log/Dispatch/Output.pm line 30 thread 3 Log::Dispatch::Output::log(undef, 'level', 1, 'name', 'app001', 'message', 'INFO - In thread 3\x{a}', 'log4p_category', 'thread-test', ...) called at /usr/share/perl5/Log/Log4perl/Appender.pm line 212 thread 3 Log::Log4perl::Appender::log('Log::Log4perl::Appender=HASH(0xb6cd93c8)', 'HASH(0x91d0668)', 'thread-test', 'INFO') called at /usr/share/perl5/Log/Log4perl/Logger.pm line 301 thread 3 Log::Log4perl::Logger::__ANON__('Log::Log4perl::Logger=HASH(0xb6cd8f68)', 'In thread 3') called at /usr/share/perl5/Log/Log4perl/Logger.pm line 782 thread 3 Log::Log4perl::Logger::__ANON__('Log::Log4perl::Logger=HASH(0xb6cd8f68)', 'In thread 3') called at syslog-thread.pl line 34 thread 3 main::log_me(3) called at syslog-thread.pl line 22 thread 3 eval {...} called at syslog-thread.pl line 22 thread 3 Attempt to free unreferenced scalar: SV 0x916ef08, Perl interpreter: 0x8eb2c68 at /usr/share/perl5/Log/Dispatch/Output.pm line 34. Attempt to free unreferenced scalar: SV 0x91dd898, Perl interpreter: 0x8eb2c68 at /usr/share/perl5/Log/Dispatch/Output.pm line 30. Attempt to free unreferenced scalar: SV 0x93be410, Perl interpreter: 0x91de938 at /usr/share/perl5/Log/Dispatch/Output.pm line 34. Attempt to free unreferenced scalar: SV 0x9754128, Perl interpreter: 0x916fc98 at /usr/share/perl5/Log/Dispatch/Output.pm line 34. Attempt to free unreferenced scalar: SV 0x916ecb8, Perl interpreter: 0x937c2e0 at /usr/share/perl5/Log/Dispatch/Output.pm line 34. Attempt to free unreferenced scalar: SV 0x916e9c8, Perl interpreter: 0x8eb2c68 at /usr/share/perl5/Log/Dispatch/Output.pm line 34. Attempt to free unreferenced scalar: SV 0xb6b83d20, Perl interpreter: 0x937c2e0 at /usr/share/perl5/Log/Dispatch/Output.pm line 34. Attempt to free unreferenced scalar: SV 0xb6b83d20, Perl interpreter: 0x937c2e0 at /usr/share/perl5/Log/Dispatch/Output.pm line 34. Attempt to free unreferenced scalar: SV 0x916ec88, Perl interpreter: 0x91de938 at /usr/share/perl5/Log/Dispatch/Output.pm line 30. Thread 4 terminated abnormally: The following parameter was passed in the call to Log::Dispatch::Output::log but was not listed in the validation options: log4p_level at /usr/share/perl5/Log/Dispatch/Output.pm line 30 thread 4 Log::Dispatch::Output::log(undef, 'level', 1, 'name', 'app001', 'message', 'INFO - In thread 4\x{a}', 'log4p_category', 'thread-test', ...) called at /usr/share/perl5/Log/Log4perl/Appender.pm line 212 thread 4 Log::Log4perl::Appender::log('Log::Log4perl::Appender=HASH(0x9308828)', 'HASH(0x93be1a0)', 'thread-test', 'INFO') called at /usr/share/perl5/Log/Log4perl/Logger.pm line 301 thread 4 Log::Log4perl::Logger::__ANON__('Log::Log4perl::Logger=HASH(0x93083c8)', 'In thread 4') called at /usr/share/perl5/Log/Log4perl/Logger.pm line 782 thread 4 Log::Log4perl::Logger::__ANON__('Log::Log4perl::Logger=HASH(0x93083c8)', 'In thread 4') called at syslog-thread.pl line 34 thread 4 main::log_me(4) called at syslog-thread.pl line 22 thread 4 eval {...} called at syslog-thread.pl line 22 thread 4 Attempt to free unreferenced scalar: SV 0xb6b83c40, Perl interpreter: 0x916fc98 at /usr/share/perl5/Log/Dispatch/Output.pm line 34. Attempt to free unreferenced scalar: SV 0x9584b50, Perl interpreter: 0x8eb2c68 at /usr/share/perl5/Log/Dispatch/Output.pm line 34. Attempt to free unreferenced scalar: SV 0xb6b83d60, Perl interpreter: 0x8eb2c68 at /usr/share/perl5/Log/Dispatch/Output.pm line 30. Attempt to free unreferenced scalar: SV 0xb6b83ef0, Perl interpreter: 0x916fc98 at /usr/share/perl5/Log/Dispatch/Output.pm line 30. Thread 1 terminated abnormally: The following parameter was passed in the call to Log::Dispatch::Output::log but was not listed in the validation options: log4p_level at /usr/share/perl5/Log/Dispatch/Output.pm line 30 thread 1 Log::Dispatch::Output::log(undef, 'level', 1, 'name', 'app001', 'message', 'INFO - In thread 1\x{a}', 'log4p_category', 'thread-test', ...) called at /usr/share/perl5/Log/Log4perl/Appender.pm line 212 thread 1 Log::Log4perl::Appender::log('Log::Log4perl::Appender=HASH(0x90d9070)', 'HASH(0x916e8a8)', 'thread-test', 'INFO') called at /usr/share/perl5/Log/Log4perl/Logger.pm line 301 thread 1 Log::Log4perl::Logger::__ANON__('Log::Log4perl::Logger=HASH(0x90d8c10)', 'In thread 1') called at /usr/share/perl5/Log/Log4perl/Logger.pm line 782 thread 1 Log::Log4perl::Logger::__ANON__('Log::Log4perl::Logger=HASH(0x90d8c10)', 'In thread 1') called at syslog-thread.pl line 34 thread 1 main::log_me(1) called at syslog-thread.pl line 22 thread 1 eval {...} called at syslog-thread.pl line 22 thread 1 Thread 2 terminated abnormally: The following parameter was passed in the call to Log::Dispatch::Output::log but was not listed in the validation options: log4p_level at /usr/share/perl5/Log/Dispatch/Output.pm line 30 thread 2 Log::Dispatch::Output::log(undef, 'level', 1, 'name', 'app001', 'message', 'INFO - In thread 2\x{a}', 'log4p_category', 'thread-test', ...) called at /usr/share/perl5/Log/Log4perl/Appender.pm line 212 thread 2 Log::Log4perl::Appender::log('Log::Log4perl::Appender=HASH(0xb6dee720)', 'HASH(0xb6b83990)', 'thread-test', 'INFO') called at /usr/share/perl5/Log/Log4perl/Logger.pm line 301 thread 2 Log::Log4perl::Logger::__ANON__('Log::Log4perl::Logger=HASH(0xb6dee2c0)', 'In thread 2') called at /usr/share/perl5/Log/Log4perl/Logger.pm line 782 thread 2 Log::Log4perl::Logger::__ANON__('Log::Log4perl::Logger=HASH(0xb6dee2c0)', 'In thread 2') called at syslog-thread.pl line 34 thread 2 main::log_me(2) called at syslog-thread.pl line 22 thread 2 eval {...} called at syslog-thread.pl line 22 thread 2 Segmentation fault my system is (uname -a) Linux lindesktop21 2.6.32-31-generic #61-Ubuntu SMP Fri Apr 8 18:24:35 UTC 2011 i686 GNU/Linux My Perl version is Summary of my perl5 (revision 5 version 10 subversion 1) configuration: Platform: osname=linux, osvers=2.6.24-28-server, archname=i486-linux-gnu-thread-multi uname='linux roseapple 2.6.24-28-server #1 smp wed aug 18 21:17:51 utc 2010 i686 gnulinux ' config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i486-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.10 -Darchlib=/usr/lib/perl/5.10 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.10.1 -Dsitearch=/usr/local/lib/perl/5.10.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so.5.10.1 -Dd_dosuid -des' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2 -g', cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.4.3', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib /usr/lib64 libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt perllibs=-ldl -lm -lpthread -lc -lcrypt libc=/lib/libc-2.11.1.so, so=so, useshrplib=true, libperl=libperl.so.5.10.1 gnulibc_version='2.11.1' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Apr 22 2011 18:17:20 @INC: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl I attached a patch. It loads the threads module if Perl was compiled with the ithreads options, then it locks before openning connection to syslog. Best regards Cedric
Download (untitled) / with headers
text/html 13.2k

Message body is not shown because it is too large.

Download Syslog.pm.patch
text/x-diff 690b

Message body is not shown because sender requested not to inline it.

Download syslog-thread.pl
text/x-perl 673b

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #67988] Log::Dispatch::Syslog isn't thread-safe
Date: Fri, 6 May 2011 10:08:31 -0500 (CDT)
To: Cedric Carree via RT <bug-Log-Dispatch [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
Download (untitled) / with headers
text/plain 636b
On Fri, 6 May 2011, Cedric Carree via RT wrote: Show quoted text
> Using Perl 5.6.0 threads, the Log::Dispatch::Syslog may SEGV. This is maybe a bug on Sys::Syslog rather than Log::Dispatch::Syslog > I think this is because Sys::Syslog tries to open and/or close twice the connection to syslog (in two differents threads).
You say 5.6.0 but you're using Perl 5.10.1. I assume you don't mean 5.6.0. -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
Subject: Re: [rt.cpan.org #67988] Log::Dispatch::Syslog isn't thread-safe
Date: Fri, 6 May 2011 17:37:53 +0200 (CEST)
To: bug-Log-Dispatch [...] rt.cpan.org
From: Cedric Carree <cedric.carree [...] mancalanetworks.com>
Download (untitled) / with headers
text/plain 946b
I would say "perl threads as defined since Perl 5.6.0, not perl threads as defined in Perl 5.005" Otherwise I should have say that I'm using rsyslog 4.2.0-2ubuntu8.1 and Log::Dispatch::Syslog 2.29. Show quoted text
----- Original Message -----
> <URL: http://rt.cpan.org/Ticket/Display.html?id=67988 > > > On Fri, 6 May 2011, Cedric Carree via RT wrote: >
> > Using Perl 5.6.0 threads, the Log::Dispatch::Syslog may SEGV. This > > is maybe a bug on Sys::Syslog rather than Log::Dispatch::Syslog > > I think this is because Sys::Syslog tries to open and/or close twice > > the connection to syslog (in two differents threads).
> > You say 5.6.0 but you're using Perl 5.10.1. I assume you don't mean > 5.6.0. > > > -dave > > /*============================================================ > http://VegGuide.org http://blog.urth.org > Your guide to all that's veg House Absolute(ly Pointless) > ============================================================*/
Subject: Log::Dispatch::Syslog is not thread-safe
Download (untitled) / with headers
text/plain 3.5k
Dear Log-Dispatch maintainers, Recently, I have encountered several problems with a multi-threading application using logging mechanisms through Log::Any inside my worker threads. Log::Any will be dispatched through Log::Dispatch::Syslog to write to UNIX syslog. The parallel logging caused various errors and warnings such as: - Segmentation faults, - Scalars leaked warnings, - and various memory leaks. Here is an example of an error-context under valgrind: ==23949== Invalid read of size 1 ==23949== at 0x4128C7A: _IO_default_xsputn (genops.c:479) ==23949== by 0x4125A7A: fputs_unlocked (iofputs_u.c:40) ==23949== by 0x418AC83: __vsyslog_chk (syslog.c:207) ==23949== by 0x418B165: syslog (syslog.c:119) ==23949== by 0x5AB0D3E: XS_Sys__Syslog_syslog_xs (in /.../lib/5.14.0/i686-linux-thread-multi/auto/Sys/Syslog/Syslog.so) ==23949== by 0x80E2C40: Perl_pp_entersub (in /.../bin/perl) ==23949== by 0x80D9F97: Perl_runops_standard (in /.../bin/perl) ==23949== by 0x807372B: Perl_call_sv (in /.../bin/perl) ==23949== by 0x4E42AB3: S_ithread_run (in /.../lib/5.14.0/i686-linux-thread-multi/auto/threads/threads.so) ==23949== by 0x40ADEED: start_thread (pthread_create.c:301) ==23949== by 0x418EB1D: clone (clone.S:133) ==23949== Address 0x5d5b852 is 2 bytes inside a block of size 20 free'd ==23949== at 0x4024953: free (in /.../valgrind/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==23949== by 0x80E8E09: Perl_sv_clear (in /.../bin/perl) ==23949== by 0x80E96A9: Perl_sv_free2 (in /.../bin/perl) ==23949== by 0x5AAFFBD: XS_Sys__Syslog_closelog_xs (in /.../lib/5.14.0/i686-linux-thread-multi/auto/Sys/Syslog/Syslog.so) ==23949== by 0x80E2C40: Perl_pp_entersub (in /.../bin/perl) ==23949== by 0x80D9F97: Perl_runops_standard (in /.../bin/perl) ==23949== by 0x80792EB: perl_run (in /.../bin/perl) ==23949== by 0x805CB5C: main (in /.../bin/perl) (Note: I shortened the lib path for convenience). The segmentation fault errors differ from a run to another, same holds for leaked scalars, however, memory leaks (analyzed with Valgrind) are happening in every run. I encountered the issue when dispatching Log::Any to Log::Dispatch::Syslog. However, when dispatching to Log::Dispatch::Screen, every run is error-free and warning-free. I came across an old ticket, never closed, which faced the same issue as I am (id=67988): https://rt.cpan.org/Public/Bug/Display.html?id=67988 . The author of the ticket, Cedric Caree, proposed a patch (https://rt.cpan.org/Ticket/Attachment/931633/483570/Syslog.pm.patch) that fixed my issue. Quoting Cedric, the patch "loads the threads module if Perl was compiled with the ithreads options, then it locks before opening connection to syslog.". Cedric also provides some testing script to reproduce the issue. To my understanding, the error is being caused when concurrent log_message happen in Log::Dispatch::Syslog. No concurrency mechanism would prevent these concurrent calls to happen. Therefore, a locking of log_message sounds reasonable. I am using following perl version: Perl v5.14.0 built for i686-linux-thread-multi. I am using following version of Log::Dispatch: v2.35. I am using following version of Sys::Syslog: v0.27. At the moment, I maintain this patch for Log-Dispatch-2.35. However, it would be much easier to me in the future if you could integrate this fix to the current version of the module and release a new one. If you have any further question, don't hesitate to contact me. Kind regards, Franck -- franck youssef junior engineer open systems ag fry@open.ch http://www.open.ch
Subject: Log-Dispatch-2.39.patch
diff -rupN Log-Dispatch-2.39.orig/lib/Log/Dispatch/Syslog.pm Log-Dispatch-2.39.patched/lib/Log/Dispatch/Syslog.pm --- Log-Dispatch-2.39.orig/lib/Log/Dispatch/Syslog.pm 2013-04-21 16:40:14.000000000 +0200 +++ Log-Dispatch-2.39.patched/lib/Log/Dispatch/Syslog.pm 2013-05-02 16:09:12.000000000 +0200 @@ -15,6 +15,17 @@ Params::Validate::validation_options( al use Sys::Syslog 0.25 (); +use Config; + +my $locker; #thread locker +BEGIN { + if ( $Config{useithreads} ) { + use threads; + use threads::shared; + share($locker); + } +} + sub new { my $proto = shift; my $class = ref $proto || $proto; @@ -83,6 +94,8 @@ sub log_message { my $pri = $self->_level_as_number( $p{level} ); eval { + lock($locker) if ( $Config{useithreads} ); + Sys::Syslog::openlog( $self->{ident}, $self->{logopt}, $self->{facility}
Download (untitled) / with headers
text/plain 3.9k
On Fri May 03 03:29:15 2013, daa wrote: Show quoted text
> Dear Log-Dispatch maintainers, > > Recently, I have encountered several problems with a multi-threading > application using logging mechanisms through Log::Any inside my worker > threads. Log::Any will be dispatched through Log::Dispatch::Syslog to > write to UNIX syslog. > > The parallel logging caused various errors and warnings such as: > > - Segmentation faults, > - Scalars leaked warnings, > - and various memory leaks. > > Here is an example of an error-context under valgrind: > ==23949== Invalid read of size 1 > ==23949== at 0x4128C7A: _IO_default_xsputn (genops.c:479) > ==23949== by 0x4125A7A: fputs_unlocked (iofputs_u.c:40) > ==23949== by 0x418AC83: __vsyslog_chk (syslog.c:207) > ==23949== by 0x418B165: syslog (syslog.c:119) > ==23949== by 0x5AB0D3E: XS_Sys__Syslog_syslog_xs (in > /.../lib/5.14.0/i686-linux-thread-multi/auto/Sys/Syslog/Syslog.so) > ==23949== by 0x80E2C40: Perl_pp_entersub (in /.../bin/perl) > ==23949== by 0x80D9F97: Perl_runops_standard (in /.../bin/perl) > ==23949== by 0x807372B: Perl_call_sv (in /.../bin/perl) > ==23949== by 0x4E42AB3: S_ithread_run (in /.../lib/5.14.0/i686- > linux-thread-multi/auto/threads/threads.so) > ==23949== by 0x40ADEED: start_thread (pthread_create.c:301) > ==23949== by 0x418EB1D: clone (clone.S:133) > ==23949== Address 0x5d5b852 is 2 bytes inside a block of size 20 > free'd > ==23949== at 0x4024953: free (in > /.../valgrind/lib/valgrind/vgpreload_memcheck-x86-linux.so) > ==23949== by 0x80E8E09: Perl_sv_clear (in /.../bin/perl) > ==23949== by 0x80E96A9: Perl_sv_free2 (in /.../bin/perl) > ==23949== by 0x5AAFFBD: XS_Sys__Syslog_closelog_xs (in > /.../lib/5.14.0/i686-linux-thread-multi/auto/Sys/Syslog/Syslog.so) > ==23949== by 0x80E2C40: Perl_pp_entersub (in /.../bin/perl) > ==23949== by 0x80D9F97: Perl_runops_standard (in /.../bin/perl) > ==23949== by 0x80792EB: perl_run (in /.../bin/perl) > ==23949== by 0x805CB5C: main (in /.../bin/perl) > (Note: I shortened the lib path for convenience). > > The segmentation fault errors differ from a run to another, same holds > for leaked scalars, however, memory leaks (analyzed with Valgrind) are > happening in every run. > > I encountered the issue when dispatching Log::Any to > Log::Dispatch::Syslog. However, when dispatching to > Log::Dispatch::Screen, every run is error-free and warning-free. > > I came across an old ticket, never closed, which faced the same issue > as I am (id=67988): > https://rt.cpan.org/Public/Bug/Display.html?id=67988 . > The author of the ticket, Cedric Caree, proposed a patch > (https://rt.cpan.org/Ticket/Attachment/931633/483570/Syslog.pm.patch) > that fixed my issue. Quoting Cedric, the patch "loads the threads > module if Perl was compiled with the ithreads options, then it locks > before opening connection to syslog.". Cedric also provides some > testing script to reproduce the issue. > To my understanding, the error is being caused when concurrent > log_message happen in Log::Dispatch::Syslog. No concurrency mechanism > would prevent these concurrent calls to happen. Therefore, a locking > of log_message sounds reasonable. > > I am using following perl version: Perl v5.14.0 built for i686-linux- > thread-multi. > I am using following version of Log::Dispatch: v2.35. > I am using following version of Sys::Syslog: v0.27. > > At the moment, I maintain this patch for Log-Dispatch-2.35. However, > it would be much easier to me in the future if you could integrate > this fix to the current version of the module and release a new one. > > If you have any further question, don't hesitate to contact me.
Franck, thanks for the bug report, and sorry it's taken so long for me to respond. I don't think this patch is a good idea, since it loads threads even in programs that are not using them. I think it might be better to simply add a thread option to the syslog logger output constructor params so it only locks when requested to. I'll add this for the next release.
Subject: Re: [rt.cpan.org #85013] Log::Dispatch::Syslog is not thread-safe
Date: Tue, 12 Aug 2014 09:55:14 -0700
To: Dave Rolsky via RT <bug-Log-Dispatch [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
Download (untitled) / with headers
text/plain 612b
On Tue, Aug 12, 2014 at 12:45:16PM -0400, Dave Rolsky via RT wrote: Show quoted text
> I don't think this patch is a good idea, since it loads threads even in programs that are not using them. I think it might be better to simply add a thread option to the syslog logger output constructor params so it only locks when requested to. > > I'll add this for the next release.
Isn't the problem simply that one logger object is being used across multiple threads? In that case, simply create a new one in each thread. (I ran into similar issues myself, which is how https://metacpan.org/pod/Object::ForkAware came to be written.)
Download (untitled) / with headers
text/plain 838b
On Tue Aug 12 12:55:22 2014, ETHER wrote: Show quoted text
> On Tue, Aug 12, 2014 at 12:45:16PM -0400, Dave Rolsky via RT wrote:
> > I don't think this patch is a good idea, since it loads threads even > > in programs that are not using them. I think it might be better to > > simply add a thread option to the syslog logger output constructor > > params so it only locks when requested to. > > > > I'll add this for the next release.
> > Isn't the problem simply that one logger object is being used across > multiple threads? In that case, simply create a new one in each > thread. > (I ran into similar issues myself, which is how > https://metacpan.org/pod/Object::ForkAware came to be written.)
Karen, the issue is the calls to openlog, syslog, and closelog. These aren't scoped to an object, they're global (syslog just has a very old school API).


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.