Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronized Appender locking up system with semaphores #88

Open
marcelser opened this issue Feb 21, 2018 · 3 comments
Open

Synchronized Appender locking up system with semaphores #88

marcelser opened this issue Feb 21, 2018 · 3 comments

Comments

@marcelser
Copy link

marcelser commented Feb 21, 2018

Hi,

We have a system which forks children and we found out that sometimes log4perl messages are interleaved (especially for long messages) so we added the "Synchronized" Appenders the the logfiles and created a different semaphore (4 char long .key) for each and every appender file based logger.

At first tests it looked perfectly ok, but once we put the code on our QA testing system it started to fail miserable, we had strange lockups all over the place and as I have not really found out how that semaphores stuff is working I also feel unable to fix this issue. But I think it seems somehow the locks don't get released but I don't even know how to trace this.

BTW: We are using Log4perl 1.46 provided by centos7.

@marcelser
Copy link
Author

ok, we found out what's the problem. If any log4perl module outputs something to stderr/stdout and you're using the recipe to catch all output from stderr & stdout and redirect to log4perl you run into a semaphore deadlock as you're entering the 'log' subroutine again in a recursion and it waits indefinitly.

For the moment I have monkey patched the 'log' method of the Appender to run a counter and only lock/umlock the semaphore if counter == 0, also error handling is not done properly here, if the log method dies you're also left with a locked semaphore and system is in deadlock mode.

@Laz80UK
Copy link

Laz80UK commented Mar 21, 2019

Hi,

I had the same issue. The semaphore errors were showing up in the Centos 7 syslogs and my software stopped processing all together. Had to fall back to the following configuration:

log4perl.appender.Logfile = Log::Log4perl::Appender::File
log4perl.appender.Logfile.autoflush = 1
log4perl.appender.Logfile.mode = append
log4perl.appender.Logfile.syswrite = 1

(i.e. not using Log::Log4perl::Appender::Synchronized)

@mohawk2
Copy link
Collaborator

mohawk2 commented Sep 6, 2020

Thanks for the report. Could one of you please put here a code snippet that demonstrates the problem, or even better put it in a .t for easy adding?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants