[ZBX-10352] zabbix-agent start issues with LogType & LogFile options conflict Created: 2016 Feb 04  Updated: 2017 May 30  Resolved: 2016 Feb 09

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

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

Debian Wheezy 7.9


Attachments: File std_redirect.diff    

 Description   

With Zabbix 2.4.x, an empty LogFile configuration option meant "use syslog".
When upgrading to Zabbix 3.0, you have to set "LogType=system".

Not commenting LogFile option makes zabbix-agent start & fork, but a process is kept as zombie:

# ps fauxww | grep zabbix[_-]agent
root      4263  0.0  0.0   4180   732 pts/0    S+   16:51   0:00  |       \_ /bin/sh /etc/init.d/zabbix-agent restart
root      4288  0.0  0.0   4180   736 pts/0    S+   16:51   0:00  |           \_ /bin/sh /etc/init.d/zabbix-agent start
zabbix    4296  0.0  0.0      0     0 pts/0    Z+   16:51   0:00  |               \_ [zabbix_agentd] <defunct>


zabbix    4298  0.0  0.0  64824   932 ?        S    16:51   0:00 /usr/sbin/zabbix_agentd
zabbix    4299  0.0  0.0  64824  1048 ?        S    16:51   0:00  \_ /usr/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix    4300  0.0  0.0  64824  1076 ?        S    16:51   0:00  \_ /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix    4301  0.0  0.0  64824  1052 ?        S    16:51   0:00  \_ /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix    4302  0.0  0.0  64824   944 ?        S    16:51   0:00  \_ /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix    4303  0.0  0.0  64824   688 ?        S    16:51   0:00  \_ /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

Same behaviour occurs with zabbix_server. I haven't tested proxy yet, but I guess it would behave the same.

If LogType is set to system, Zabbix should completely ignore LogFile configuration option.



 Comments   
Comment by Jean Baptiste Favre [ 2016 Feb 04 ]

It seems that troubles occur only when using LogType=system, whatever LogFile value could be.
And it happens only when running as daemon. Zabbix-agent starts well when usind foreground option.
Have to change bug report title

Comment by Andris Zeila [ 2016 Feb 05 ]

Zabbix does the daemonizing by the usual double forking. It looks like the inital process was left as zombie. Currently I can't see how LogFile option could affect it, but will keep looking.

However I found another bug - zbx_handle_log() is called before zabbix_open_log(). This might break the initial stdout/stderr redirection to log file.

Comment by Jean Baptiste Favre [ 2016 Feb 05 ]

@wiper I was wrong in my initial assessment: LogFile has nothing to do with that bug, as stated in my comment

Comment by Andris Zeila [ 2016 Feb 05 ]

Ahh, sorry my reading comprehension failure. Still I can't repeat it on debian 8.1 :/

Comment by Andris Zeila [ 2016 Feb 05 ]

One difference I see is that Zabbix does not redirect stdout/stderr to /dev/null when logging to syslog.

Comment by Andris Zeila [ 2016 Feb 05 ]

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

Comment by Andris Zeila [ 2016 Feb 05 ]

As I could not repeat the bug, the fix is more theoretical than practical. Would it be possible to try the attached std_redirect.diff patch and see if it solves the problem? Thanks!

Comment by Jean Baptiste Favre [ 2016 Feb 05 ]

compilation in progress

Comment by Jean Baptiste Favre [ 2016 Feb 05 ]

Works for me.
Tested on agent & server. Both start well now.

Thanks !

Comment by Andris Zeila [ 2016 Feb 05 ]

Great, thanks for trying it out.

Comment by Andris Zeila [ 2016 Feb 09 ]

Releaed in:

  • pre-3.0.0rc2 r58353
Generated at Thu Apr 25 09:17:32 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.