Commit Graph

12452 Commits

Author SHA1 Message Date
Julian Brost 3ad9d3316c Compile with -D_GNU_SOURCE
Needed by `boost::stacktrace` for `_Unwind_Backtrace()`.
2021-03-01 14:07:11 +01:00
Julian Brost cdfcef4d63 CMakeLists: use HAVE_LIBEXECINFO only after actually checking for it
So far, the check that actually sets HAVE_LIBEXECINFO was executed after
it was already used to add dependencies.
2021-03-01 14:07:11 +01:00
Julian Brost 24f6283362 Add a test case for the stack trace formatter 2021-03-01 14:07:11 +01:00
Julian Brost b931194f59 Use backtrace_symbols() when printing stack traces on FreeBSD
Unfortunately, the symbol resolution of boost::stacktrace is broken on
FreeBSD, therefore fall back to using backtrace_symbols() to print the
stack trace saved by Boost.

Additionally, -D_GNU_SOURCE is required on FreeBSD for the
_Unwind_Backtrace function used by boost::stacktrace.
2021-03-01 14:07:09 +01:00
Julian Brost 7d3885d05c Crash handlers: use more compact string representation 2021-03-01 14:06:47 +01:00
Julian Brost 710cd7287f Begin crash log for SIGABRT with error message and timestamp
This makes the format more similar to what the uncaught C++ and SEH
exception handlers write. Previously there was no indication in the
crash log that a SIGABRT happened.
2021-03-01 14:06:47 +01:00
Julian Brost f084cdecbe Windows: require at least MSVC 19.20 to build
Older versions of MSVC fail to rethrow an unhandled C++ exception (using
`throw;`) in the termination handler (`std::set_terminate`), however
Icinga relies on this behavior in its crash handler
(`Application::ExceptionHandler`).
2021-03-01 14:06:47 +01:00
Julian Brost 532d37624f docs: mention use of boost::stacktrace 2021-03-01 14:06:47 +01:00
Julian Brost 1ad233da86 Add some comments to __cxa_throw
Maybe this will save the next person who has to look at this code some
time. Please don't blame me for the implementation, I'm just trying to
reconstruct what it does.
2021-03-01 14:06:47 +01:00
Julian Brost e60dd51284 Restructure stack and context trace selection in DiagnosticInformation and document behavior
The logic for selecting the traces to print stays the same, but there
are fewer nested ifs now. This changes the format of the returned string
a bit by adding a heading for both traces.
2021-03-01 14:06:47 +01:00
Julian Brost 7f2868ab36 Add documentation for cast_exception function 2021-03-01 14:06:47 +01:00
Julian Brost 15a16b23d9 Pass fallback stacktrace to DiagnosticInformation in terminate handler
By default, DiagnosticInformation uses the stack trace saved when the
exception was thrown, but this mechanism is not in use on Windows.
Gathering a stacktrace in the terminate handler serves as a fallback.
2021-03-01 14:06:47 +01:00
Julian Brost 5cb7c7cc09 Replace icinga::StackTrace with boost::stacktrace::stacktrace
Provides roughly the same functionality but works better on certain
platforms (especially Windows) and is less code to maintain.
2021-03-01 14:06:44 +01:00
Julian Brost e11b4b7b55 Print details in uncaught SEH exception handler 2021-03-01 14:05:27 +01:00
Julian Brost 68e4b807d1 Move error message and time to the beginning of the SEH crash log
This is more similar to the normal exception crashlog which also states
the problem and time at the beginning of the file.
2021-03-01 14:05:27 +01:00
Julian Brost 0db59bad83 Use boost::stacktrace instead of custom implementation in Windows SEH filter 2021-03-01 14:05:27 +01:00
Julian Brost f8b7a1511b Run termination handler for uncaught C++ exceptions on Windows
On Windows, the termination handler is executed for uncaught C++
exceptions unless a SEH unhandled exception filter is also set. In this
case, this filter has to explicitly chain the default filter to keep
this behavior.
2021-03-01 14:05:27 +01:00
Noah Hilverling 0b26515c34
Merge pull request #8636 from Icinga/feature/sles151
GitHub actions: drop SLES v15.1
2021-02-23 13:30:04 +01:00
Noah Hilverling 82ddb0d82b
Merge pull request #8637 from Icinga/feature/opensuse151
GitHub actions: drop openSUSE v15.1
2021-02-23 13:29:46 +01:00
Alexander A. Klimov 8ca701d706 GitHub actions: drop openSUSE v15.1 2021-02-15 13:51:40 +01:00
Alexander A. Klimov 959328e2c3 GitHub actions: drop SLES v15.1 2021-02-15 13:44:33 +01:00
Alexander Aleksandrovič Klimov aa4f53009e
Merge pull request #8614 from Icinga/bugfix/runworker-exceptions
Improve handling of exceptions thrown by RunWorker
2021-02-08 16:22:35 +01:00
Julian Brost 54a8c7b434 Try to log useful information for exceptions thrown by RunWorker 2021-02-05 15:43:27 +01:00
Julian Brost ddbad7937d
Merge pull request #8622 from Icinga/bugfix/dependency-ti-typo-8180
dependency.ti: fix typo
2021-02-05 11:49:03 +01:00
Alexander A. Klimov ebfa73388f dependency.ti: fix typo
refs #8180
2021-02-04 18:29:54 +01:00
Alexander Aleksandrovič Klimov aa0baf6f69
Merge pull request #8099 from Icinga/feature/std-mutex
Use std::mutex, not boost::mutex
2021-02-04 10:19:04 +01:00
Alexander A. Klimov 9154aa17eb Fix missing include 2021-02-03 09:54:57 +01:00
Alexander A. Klimov c3388e9af6 Use std::mutex, not boost::mutex 2021-02-03 09:54:57 +01:00
Alexander Aleksandrovič Klimov dbdfe189c0
Merge pull request #7092 from Icinga/bugfix/command-escape-windows-4849
Fix Windows command escape for \"
2021-02-01 11:20:44 +01:00
Julian Brost 56095b29f4 Add tests for Utility::EscapeCreateProcessArg 2021-01-29 15:15:43 +01:00
Alexander Aleksandrovič Klimov 32cae11175
Merge pull request #8613 from Icinga/bugfix/ido-built-in-checkcommand-overrides-crit-with-warn-state
IdoCheckTask: Don't override checkable critical with warn state
2021-01-28 14:26:10 +01:00
Alexander Aleksandrovič Klimov b4e85235aa
Merge pull request #8020 from Icinga/bugfix/itl-mysql-s-h-8017
check_mysql: don't set -H if -s is given
2021-01-28 11:27:34 +01:00
Alexander Aleksandrovič Klimov ca52366a61
Merge pull request #8602 from Icinga/bugfix/icingadb-activation-priority
Delay start of IcingaDB until most config objects are activated
2021-01-28 10:01:37 +01:00
Alexander Aleksandrovič Klimov 9a867c2c25
Merge pull request #8513 from Icinga/bugfix/notifications-downtime-change-in-timeperiod-8509
FireSuppressedNotifications(const Notification::Ptr&): don't send notifications while suppressed by checkable
2021-01-28 10:01:23 +01:00
Julian Brost d7833a5977 Catch exceptions thrown by RunWorker on Windows
The same is already done on other platforms in line 529.
2021-01-27 15:48:28 +01:00
Alexander Aleksandrovič Klimov 8d1e958275
Make code doc more readable
Co-authored-by: Julian Brost <julian.brost@icinga.com>
2021-01-27 15:43:37 +01:00
Yonas Habteab 3e5dfa9607 IdoCheckTask: Don't override checkable critical with warn state 2021-01-27 13:27:14 +01:00
Julian Brost 9219f68c83
Merge pull request #8158 from Icinga/bugfix/check-source-passive-7948
Checkable#ProcessCheckResult(): don't overwrite check source
2021-01-26 10:49:55 +01:00
Alexander A. Klimov c3eba7e88d Checkable#ProcessCheckResult(): don't overwrite check source
... set by passive check results.

refs #7948
2021-01-25 16:05:03 +01:00
Alexander Aleksandrovič Klimov 91ffa89dad
Merge pull request #7918 from Icinga/feature/check-timeouts-sigterm-6162
On check_timeout first send SIGTERM
2021-01-21 16:11:07 +01:00
Alexander Aleksandrovič Klimov 124f98eed4
Merge pull request #8600 from Icinga/feature/flapping-ignore-unknown
Flapping: Allow to ignore states in flapping detection
2021-01-21 13:47:44 +01:00
Alexander Aleksandrovič Klimov b1719883a3
Merge pull request #8604 from Icinga/bugfix/icingadb-initial-sync-delay
IcingaDB: start initial dump in callback instead of timer
2021-01-21 13:47:12 +01:00
Alexander Aleksandrovič Klimov ef23ae5f3c
Merge pull request #8267 from efuss/passive_reach
Drop passive check results for unreachable hosts/services
2021-01-20 17:07:52 +01:00
Noah Hilverling e060995fd8 Flapping: Allow to ignore states in flapping calculation 2021-01-20 11:09:03 +01:00
Alexander Aleksandrovič Klimov 5e810f30a7
Merge pull request #8605 from Icinga/bugfix/icingadb-initial-sync-log
IcingaDB: wait for queries to be executed in inital sync
2021-01-20 10:47:46 +01:00
Julian Brost 2d080f14eb IcingaDB: start initial dump in callback instead of timer
Previously, the initial config dump was started in a timer executed
every 15 seconds. During the first execution of the timer, the Redis
connection is typically not established yet. Therefore, this delayed the
initial sync by up to 15 seconds.

This commit instead triggers the sync from a callback that is executed
after the connection is successfully established.

The timer is removed completely. On first glance, it looks like it would
ensure that a lost connection is reestablished, but this is handled
internally by RedisConnection. After the config has been dumped once,
that timer wouldn't ever attempt a reconnect anyways.
2021-01-20 09:31:27 +01:00
Edgar Fuß 3c050fcc46 Drop passive check results for unreachable hosts/services
Disregard passive check results while no active checks are being scheduled due to violated dependencies.

This copes with the fact that programs feeding passive check results into Icinga may have no notion of reachability and so drive a checkable into HARD state although dependencies have caused active check scheduling being suspended. This may prevent superflous problem notifications being emitted during recovery.

As disable_checks defaults to false, it was regarded OK (by @Al2Klimov) to make this behaviour (which resembles the active check case) unconditional and not conditionalize it on an additional attribute.

In the description of disable_checks, note that a value of true both disables scheduling of active checks and drops passive check results.
2021-01-19 20:08:38 +01:00
Julian Brost 174f7f75a8 IcingaDB: wait for queries to be executed in inital sync
This delays the log message stating that the initial dump is done until
all queries are actually done and now logs a meaningful duration. In
addition, this delays the return of the function and therefore when
state variables are updated by the caller.
2021-01-19 17:14:42 +01:00
Alexander Aleksandrovič Klimov 3976f256a8
Merge pull request #8593 from Icinga/bugfix/activate-items-assertion
Remove incorrect assertion in ConfigItem::ActivateItems
2021-01-19 13:52:16 +01:00
Alexander Aleksandrovič Klimov cbd0d6ea6e
Merge pull request #8588 from Icinga/bugfix/concurrent-schedule-downtime-delete-host
Fix null pointer dereferences when deleting objects while scheduling downtimes
2021-01-19 13:51:08 +01:00