[ZBX-11816] Deadlock If Crashed With Log Mutex Locked Created: 2017 Feb 15 Updated: 2019 Dec 10 |
|
Status: | Open |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent (G), Proxy (P), Server (S) |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Incident report | Priority: | Trivial |
Reporter: | Vladislavs Sokurenko | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 0 |
Labels: | deadlock, hang, logging, semaphores | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: |
![]() |
Story Points: | 1 |
Description |
There are several bug reports of zabbix hanging They all hang because process that uses zabbix log function locks mutex then crashes during fprintf and signal handler for the same process try to log again, but mutex is already locked by the same process and all other processes also wait for mutex to be freed. Furthermore this issue is dangerous because it simply hangs and user don't understand what is happening, there is no log entry, this must be very frustrating.
printf("%s", NULL);
Result is that (NULL) is printed However on Solaris 10 SPARC T4-2 Furthermore, it's possible that not all logs are enabled during testing or not valid pointer is passed to log function and it's unnoticed. This can be fixed by making mutex reentrant, patch with idea is attached. More info: Note: |
Comments |
Comment by Glebs Ivanovskis (Inactive) [ 2017 Feb 15 ] |
Alternative option is to use zbx_error() in fatal signal handler. It does not lock the log file. glebs.ivanovskis Check __zbx_zbx_error() function. It simply prints to stderr. Normally we redirect stderr to the same place as logging. __zbx_zabbix_log() is much more complicated, it rotates log files when necessary, manages concurrent output, adds very precise timestamps to messages, etc. vso This should be investigated if task will get assigned, however I don't see why it would be acceptable to write to file from multiple processes without lock. |