NagiosEnterprises / nagioscore

Nagios Core
GNU General Public License v2.0
1.58k stars 451 forks source link

memory leak when log file is set to /dev/null #690

Open csb1582 opened 5 years ago

csb1582 commented 5 years ago

Background: Nagios Core 4.4.4 compiled from source. No special options, just run ./configure Running in Docker container on Centos 7 host with latest updates.

Issue: We don't want/need Nagios logs, so we set _logfile parameter to /dev/null When this is done Nagios starts, however memory size of Nagios process continues to grow indefinitely until all memory on host is exhausted. If _logfile is set to regular file Nagios works as expected.

How to reproduce: Configure Nagios with _logfile=/dev/null and execute some checks. Process size will grow. If more checks are scheduled the nagios process will grow more.

What you expect to happen: By setting _logfile to /dev/null anything recorded to log should be discarded, without causing additional memory usage.

Workaround: Before starting Nagios, create symlink as follows- ln -sf /dev/null /usr/local/nagios/var/nagios.log (replace with log_file param), and set _log_rotationmethod to n (otherwise Nagios will rotate the symlink itself, and then continue writing file)

sawolf commented 5 years ago

Hi @csb1582, thanks for the report. I'll look into this soon.

sampadap03 commented 1 year ago

Hi @sawolf did you look into this issue? what is your analysis?