icingadb-web icon indicating copy to clipboard operation
icingadb-web copied to clipboard

There is no timout for actual APICommandTransport calls

Open SebastianOpeni opened this issue 1 year ago • 2 comments

Describe the bug

An unreachable command Transport endpoint will block the execution for a very long time until a second CommandTransportEndpoint will be tried. When configuring the Endpoints the probe call utilizes such a timeout but the actual calls are run without such a configuration.

Probe with timeout: https://github.com/Icinga/icingadb-web/blob/main/library/Icingadb/Command/Transport/ApiCommandTransport.php#L314 Actual call without: https://github.com/Icinga/icingadb-web/blob/main/library/Icingadb/Command/Transport/ApiCommandTransport.php#L240

To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this issue. Include configuration, logs, etc. to reproduce, if relevant.

  1. Set up a fake non working CommandTransport Endpoint ( for example with "ncat -lvnp 5665 --keep-open") to simulate an outage
  2. Configure said fake commandTranspoirt Endpoint (force its config, since the ui-config will correctly fail after 15 seconds)
  3. Configure a working CommandTransport Endpoint as second option
  4. Try to send a Command (for example a "recheck")
  5. The "recheck command" will not be send to the second Endpoint for multiple minutes and the ui will freeze. This makes working with icingaweb impossible without changing the commandTransport Endpoint order.

Expected behavior

After the first commandEndpoint is not reacting for some time (for example if a network error happened), I would expect it to switch over the the second endpoint after some seconds and not after multiple minutes.

Logs

2025-02-19T10:46:10+01:00 - DEBUG - Sending Icinga command "actions/reschedule-check" to the API "testserver:5665" 2025-02-19T10:51:10+01:00 - ERROR - Icinga\Module\Icingadb\Command\Transport\CommandTransportException in /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Command/Transport/ApiCommandTransport.php:249 with message: Can't connect to the Icinga 2 API: 0 cURL error 28: SSL connection timeout (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://testserver.de:5665/v1/actions/reschedule-check 2025-02-19T10:51:10+01:00 - DEBUG - Sending Icinga command "actions/reschedule-check" to the API "correcthost:5665"

Your Environment

Include as many relevant details about the environment you experienced the problem in.

  • Icinga DB Web version (System - About): 1.1.3
  • Icinga Web 2 version (System - About): 2.12.2
  • Web browser: firefox 128.7.0esr (64-bit)
  • Icinga 2 version (icinga2 --version): v2.14.4
  • Icinga DB version (icingadb --version): 1.2.1
  • PHP version used (php --version): 8.2.24
  • Server operating system and version: Debian12

Additional context

I forked this repo and added the missing timeout parameter, if this gets acknowledged as a bug I will create a PullRequest. https://github.com/open-i-gmbh/icingadb-web/tree/fix/set-api-timeout-also-for-actual-api-call

SebastianOpeni avatar Feb 19 '25 09:02 SebastianOpeni

if this gets acknowledged as a bug I will create a PullRequest.

Please do. Thank you 😄

nilmerg avatar Feb 19 '25 10:02 nilmerg

thanks for the fast reply :) I did so here: https://github.com/Icinga/icingadb-web/pull/1139

SebastianOpeni avatar Feb 19 '25 10:02 SebastianOpeni