[Home]

Summary:ASTERISK-04504: [patch] segfault when Asterisk auto-rotates log on getting a SIGXFSV on a log file write (which means file too large)
Reporter:Steve Davies . (stevedavies)Labels:
Date Opened:2005-06-30 11:03:16Date Closed:2008-01-15 15:39:57.000-0600
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk-logger.patch
Description:Symptom is an asterisk crash with segfault - caused by Asterisk attempting an automatic logfile rotation when a log file gets to 2GB in size.

If logger.c gets a SIGXFSV whilst writing a log file, there is code in logger.c to attempt to automatically rotate the logs.  This code was being triggered on my system.

Unfortunately, the called reload_logger  routine itself calls ast_log.  It does this whilst the pending_logger_reload flag is still set to 1.  So, ast_log again calls reload_logger, which again calls ast_log, which calls reload_logger etc etc until we fall over.

I attach a simple patch which moves the clearing of pending_logger_reload to BEFORE ast_log is called.  This fixes the crash.

You have my disclaimer on file; I read the guidelines and can't find any similar bug report.  Its in diff 0u format.  Anything I've forgotten?

Regards,
Steve Davies
Comments:By: Steve Davies . (stevedavies) 2005-07-04 04:40:44

Hi,

Is there a problem with this one?  its a reproducible seg fault with an easy fix!

Steve

By: Kevin P. Fleming (kpfleming) 2005-07-05 16:23:36

No, there was nothing holding up this patch, other than lack of time to review/commit any patches at all :-(

I've committed it to CVS HEAD, although I modified it a bit to use a better name for the global variable so there's no confusion as to when it should be set and cleared. Thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:39:57.000-0600

Repository: asterisk
Revision: 6031

U   trunk/logger.c

------------------------------------------------------------------------
r6031 | kpfleming | 2008-01-15 15:39:56 -0600 (Tue, 15 Jan 2008) | 2 lines

ensure that filesize-triggered reloads don't recurse (bug ASTERISK-4504, with mods)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=6031