There are several issues related to timeout functionality observed in zabbix_js:
create file /tmp/script.js so it sleeps for 11 seconds:
execute it with timeout 0, result:
zabbix_js waited for 10 seconds and then timeout out.
change file contents to sleep for 9 seconds:
execute it, result:
after 9 seconds zabbix_js completed successfully.
set timeout to some large value, result:
zabbix_js fails immidately with timeout error.
set timeout to negative value, result:
zabbix_js fails immediately with timeout error.
set timeout to an invalid value, result:
zabbix_js times out in 10 seconds.
1) There is a default timeout of 10 seconds, but it is not mentioned anywhere in documentation or help message:
Note, that zabbix_get does mention the valid range and default timeout value in both documentation and helper message (zabbix_get in 5.0 does not have timeout option at all, so 6.0 version was used as an example)
2) Setting timeout to 0 seconds, does not set the timeout to 0 seconds or disables the timeout.
The resulting behaviour is identical to setting timeout to an invalid value like 'd'. In both cases - the resulting timeout is set to default 10 seconds.
3) Setting timeout to negative value is identical to setting timeout to very large value. In both cases script times out immediately with timeout error.
Current behaviour is wrong and we should add proper timeout validation and update the documentation and helper message to mention the valid interval and default value.