[ZBX-10034] On Windows agents should use per-logfile locks instead of common locks between all agents in session Created: 2015 Oct 30  Updated: 2017 May 30  Resolved: 2015 Dec 13

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 2.2.10
Fix Version/s: 3.0.0alpha5

Type: Incident report Priority: Major
Reporter: Sandis Neilands (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: semaphores
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows Server 2008.



 Description   

See sub-issue (133) of ZBXNEXT-1263, ZBX-10033.

Currently on Windows all agents running in the same session (same lock namespace) use common locks: ZBX_MUTEX_LOG, ZBX_MUTEX_PERFSTAT.

This is a risky dependency between agents. Possible effects:

  • reduced performance due to all agents waiting in line to acquire the same lock;
  • stalls of all agents in case one of them gets stuck after acquiring lock (due to debugging, stopping from process manager by user, etc.);
  • in case of problem with the lock itself (it is removed by admin, abandoned by one agent, etc.) all agents are affected.

In Unix we use SysV mutexes with limited namespace. On Windows we can convert at least ZBX_MUTEX_LOG to the name of the log file that this lock is protecting.

We could also use configuration file or hostname (if -m was used) as a prefix for these locks.



 Comments   
Comment by Sandis Neilands (Inactive) [ 2015 Nov 24 ]

Opted to use process ID instead of log or configuration file names as unique identifiers of agent within session:

  • it is possible to run agent without logging to file;
  • configuration file is read only during agent's startup - it is feasible that another agent is started with the same configuration file after it has been altered slightly.

Tested on:

  • Windows 8.1 Professional 64bit (build target: Windows Server 2008);
  • Windows 2000 Professional 32bit (build target: Windows XP SP2).

Note that on Windows 2000 there is a single name-space for mutexes (there are no sessions).

Useful tool for testing: Sysinternals Process Explorer. Search for "ZBX_MUTEX" in the tool.

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-10034 .

Comment by Sandis Neilands (Inactive) [ 2015 Nov 25 ]

(1) It is possible to allocate mutex names in less than MAX_PATH length. The length of the formatted string can be determined with _sctprintf().

sandis.neilands RESOLVED in r56881.

wiper CLOSED

Comment by Andris Zeila [ 2015 Dec 07 ]

(2) As Zabbix supports only unicode builds on Windows, we are phasing out TCHAR usage.

sandis.neilands RESOLVED in r57049, r57050.

wiper CLOSED, please review minor fixes dealing with compiler warnings in r57056

sandis.neilands Thanks!

Comment by Andris Zeila [ 2015 Dec 08 ]

Successfully tested

Comment by Sandis Neilands (Inactive) [ 2015 Dec 08 ]

Released in:

  • 3.0.0alpha5 r57062.
Generated at Thu Apr 25 13:59:21 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.