[ZBX-5558] java gateway hides error messages Created: 2012 Sep 09 Updated: 2017 May 30 Resolved: 2014 Mar 06 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Java gateway (J) |
Affects Version/s: | None |
Fix Version/s: | 2.0.12rc1, 2.2.3rc1, 2.3.0 |
Type: | Incident report | Priority: | Minor |
Reporter: | richlv | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 1 |
Labels: | javagateway | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Description |
zabbix java gateway discards any output when starting the process and only checks whether the process is present (by pid). unfortunately, in some cases, java prints out an error message and exits a moment later. this makes startup script think startup was successful when it actually is not. there is no information in the gateway log, console or anywhere else. probably output should be printed to the java gateway logfile (although it might have different format ?) for example, change system hostname to an unknown one and try to start the gateway. startup is silent (as i succeeded), pidfile is present - but gateway has not been started. |
Comments |
Comment by Marc [ 2013 Mar 23 ] |
[...]only checks whether the process is present (by pid). |
Comment by richlv [ 2014 Feb 11 ] |
ZBXNEXT-2152 is somewhat related |
Comment by Aleksandrs Saveljevs [ 2014 Feb 24 ] |
Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-5558 . The fix includes the following:
|
Comment by Andris Zeila [ 2014 Mar 03 ] |
Successfully tested |
Comment by richlv [ 2014 Mar 04 ] |
(1) regarding shutdown.sh - we just send kill signal but do no verify/wait for it to shut down. something like shutdown.sh && startup.sh is almost guaranteed to fail. we probably will not want to touch these scripts for a while, so it might be a good idea to deal with this now. asaveljevs RESOLVED in r43186. The shutdown script now waits for the gateway to stop. wiper CLOSED |
Comment by richlv [ 2014 Mar 04 ] |
(2) another suggestion - we might want to include a commented out line that would enable jmx (w/o ssl, simplest possible) for startup.sh. asaveljevs Added an example to startup.sh in r43189. RESOLVED. wiper CLOSED |
Comment by Aleksandrs Saveljevs [ 2014 Mar 04 ] |
(3) Not sure whether this is an issue, but in case we have no permissions to create a PID file, the gateway starts normally with the following output from startup.sh: $ ./startup.sh ./startup.sh: 1: ./startup.sh: cannot create /zabbix_java.pid: Permission denied cat: /zabbix_java.pid: No such file or directory Zabbix Java Gateway did not start Do you think this is a problem? wiper I think starting and telling it did not is wrong. Also in this case shutdown script will give false information about gateway not running. asaveljevs Added your suggestion of touching the PID file before starting the gateway. RESOLVED in r43197. wiper CLOSED |
Comment by Andris Zeila [ 2014 Mar 05 ] |
Successfully tested |
Comment by Aleksandrs Saveljevs [ 2014 Mar 05 ] |
Fixed in pre-2.0.12 r43228, pre-2.2.3 r43229, and pre-2.3.0 (trunk) r43230. |
Comment by richlv [ 2014 Mar 05 ] |
i got really curious why this works as intended :
STDOUT=`$COMMAND_LINE & echo $! > "$PID_FILE"`
that is, why subshell, initiated by ampersand, is actually waited upon before backtick subshell exits. for example, bash manpage says :
thus one might expect the command to be executed immediately and then it's output spilling out later, potentially. or, to have a simpler example : a=`sleep 3 & echo 1` here those 3 seconds are waited upon before backtick shell returns. the reason is stdout not being disconnected in command substitution (both for java process and sleep ) - if stdout would be closed, backtick subshell would terminate. listed here : http://stackoverflow.com/questions/16874043/bash-command-substitution-forcing-process-to-foreground and also thanks to kurahaupo from #bash |
Comment by Aleksandrs Saveljevs [ 2014 Mar 06 ] |
(4) Added "Startup and shutdown scripts for Java gateway no longer hide error messages on startup, detect stale PID files, and should now work in /bin/sh." to:
asaveljevs Please take a look. RESOLVED. martins-v A slight problem here that "no longer" could be understood as "no longer detect", too. That's not intended I believe, or is it? asaveljevs You are correct, Mārtiņš. That was not intended. martins-v I split the sentence into two, to avoid ambiguity. If that's alright, this could be closed. asaveljevs Thank you! CLOSED. |