Subject: | Likely bug (and patch) in multithreaded use of Log::Dispatch::Syslog |
Date: | Mon, 29 Sep 2014 11:35:00 +0200 |
To: | bug-Log-Dispatch [...] rt.cpan.org |
From: | Sergio Fernandez <sergio.fernandez [...] meteologica.com> |
Dear Log-Dispatch developers:
I think I have found a bug in *Log::Dispatch::Syslog* module:
- The problem only shows up in multithreaded execution
- Whenever I use *log4perl.appender.syslog.lock = 0* I end up having a
script crash: it looks like two or more threads collide and execution
breaks down
- Whenever I use *log4perl.appender.syslog.lock = 1* I get no logging at
all: there is some kind of lock-related blockage and nothing comes up in
syslog files; however the script goes on running
I have solved the problem in my environment with 2 small modifications:
- Declare *Log::Dispatch::Syslog::thread_lock* as *:shared*.
- Move *lock($thread_lock)* out of *eval{}* block.
I am attaching the patch for you to check it.
Some of the system information that may be useful to you is below:
*log4perl config:*
log4perl.rootLogger = DEBUG,syslog
log4perl.appender.syslog = Log::Dispatch::SyslogMeteo
log4perl.appender.syslog.min_level = debug
log4perl.appender.syslog.ident = demo
log4perl.appender.syslog.logopt = cons,pid,ndelay
*log4perl.appender.syslog.lock = 1*
log4perl.appender.syslog.facility = local3
log4perl.appender.syslog.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.syslog.layout.ConversionPattern = %p - %m
*# uname -a*
Linux xxxxxxxx 2.6.38-16-server #67~lucid1-Ubuntu SMP Fri Sep 7 18:36:10
UTC 2012 x86_64 GNU/Linux
*# perl -v*
(...)
This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
(...)
*# cpanp l Log::Dispatch::Syslog*
Details for 'Log::Dispatch::Syslog'
Author Dave Rolsky (autarch@urth.org)
Description None given
Development Stage Unknown
Installed File /usr/local/share/perl/5.10.1/Log/Dispatch/Syslog.pm
Interface Style Unknown
Language Used Unknown
Package Log-Dispatch-2.42.tar.gz
Public License Unknown
Support Level Unknown
Version Installed 2.42
Version on CPAN 2.42
Contains: Log::Dispatch 2.42
Log::Dispatch::ApacheLog 2.42
Log::Dispatch::Base 2.42
Log::Dispatch::Code 2.42
Log::Dispatch::Email 2.42
Log::Dispatch::Email::MIMELite 2.42
Log::Dispatch::Email::MailSend 2.42
Log::Dispatch::Email::MailSender 2.42
Log::Dispatch::Email::MailSendmail 2.42
Log::Dispatch::File 2.42
Log::Dispatch::File::Locked 2.42
Log::Dispatch::Handle 2.42
Log::Dispatch::Null 2.42
Log::Dispatch::Output 2.42
Log::Dispatch::Screen 2.42
Log::Dispatch::Syslog 2.42
Best regards
--
Sergio Fernández Muñoz <sergio.fernandez@meteologica.com>
Meteológica S.A.
C/ Heliotropo, 5
28029 Madrid
Tel. +34 914 561 001 Ext: 127
Fax. +34 914 561 002
LOPD y LSSI: De acuerdo con la legislación vigente en materia de Protección
de Datos de Carácter Personal (Ley 15/1999 del 13 de Diciembre), le
informamos que su dirección de correo electrónico y los mensajes que
pudiéramos recibir pasarán a formar parte de un fichero denominado EMAILS,
del que es responsable Meteológica, S.A. Puede ejercer sus derechos de
acceso, cancelación, modificación y oposición en la dirección postal C/
Heliotropo, 5 bajo, 28029 Madrid Tel. 914561001 Fax 914561002. La finalidad
de este fichero es la de realizar una correcta gestión y prestación de los
servicios ofrecidos por Meteológica, S.A. a sus clientes, no cediéndose en
ningún momento los datos facilitados.
This email and any files transmitted with it are confidential and may be
privileged and are intended solely for the use of the individual or entity
to whom they are addressed. If you are not an addressee, any unauthorised
direct or indirect dissemination, distribution, publication or copying of
this message and any attachments is strictly prohibited. If you have
received this email in error please notify the sender immediately, and
delete this email from your system.
Message body is not shown because sender requested not to inline it.