[ZBX-9002] Zabbix does not lock log file during logging Created: 2014 Nov 06  Updated: 2017 May 30  Resolved: 2014 Dec 02

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G), Proxy (P), Server (S)
Affects Version/s: 2.0.13, 2.2.7, 2.4.2
Fix Version/s: 2.5.0

Type: Incident report Priority: Major
Reporter: Andris Zeila Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: logging
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Unix-like systems


Issue Links:
Duplicate
is duplicated by ZBX-9284 Small size of the zabbix_server.log.o... Closed
is duplicated by ZBX-8915 Log rotation seems to be broken Closed

 Description   

src/libs/zbxsys/mutexs.c
The mutex operation (locking, unlocking) functions first check if the mutex is valid with following code:

	if (ZBX_MUTEX_NULL == *mutex)
		return;

But on *nix like systems ZBX_MUTEX_NULL matches ZBX_MUTEX_LOG value (0). So the log mutex is never locked.

We should change ZBX_MUTEX_NULL to (-1) for *nix systems.



 Comments   
Comment by Andris Zeila [ 2014 Nov 06 ]

(1) While at that we also could replace ZBX_MUTEX_ERROR, ZBX_MUTEX_OK with FAIL, SUCCEED.

igorsh RESOLVED in r50607.

asaveljevs Your changes define ZBX_MUTEX_OK to SUCCEED and ZBX_MUTEX_ERROR to FAIL, whereas the real intention behind Andris' proposal was to remove ZBX_MUTEX_OK and ZBX_MUTEX_ERROR altogether, replacing them with SUCCEED and FAIL, respectively. REOPENED.

igorsh RESOLVED in r50891.

asaveljevs CLOSED

Comment by Igors Homjakovs (Inactive) [ 2014 Nov 14 ]

Fixed in svn://svn.zabbix.com/branches/dev/ZBX-9002

Comment by Igors Homjakovs (Inactive) [ 2014 Dec 02 ]

The performance overhead of this fix has been evaluated. Ten poller processes where used. Each process started writing 100000 log messages to the log file after startup. Without locking it took ~3.1 sec for each process to complete this task. With locking the result was ~3.8 sec. This shows that log file locking added approximately 20% overhead in this scenario.

Comment by Igors Homjakovs (Inactive) [ 2014 Dec 02 ]

Available in pre-2.5.0 (trunk) r50971.

Comment by Alexander Vladishev [ 2014 Dec 02 ]

(2) Documentation

There are no any user-side functional changes.

CLOSED

Comment by richlv [ 2015 Feb 05 ]

we might have to backport this fix as per ZBX-9284

Generated at Fri Mar 29 17:47:10 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.