Alexander A. Klimov
ba842403ce
Fix circular #include
...
refs #6985
2019-04-25 08:25:28 +02:00
Alexander A. Klimov
5151f6567e
ThreadPool: use the Boost ASIO thread pool under the hood
2019-04-25 08:25:28 +02:00
Michael Friedrich
56894bea17
Buildfix
...
Obviously tired.
fixes #7138
fixes #7139
2019-04-24 12:10:57 +02:00
Michael Friedrich
df25b183cb
Add log message for log rotate; update docs
...
refs #6737
2019-04-24 11:53:27 +02:00
Alexander A. Klimov
7a8f8fd734
Timer::TimerThreadProc(): use C++11 lambda instead of bind()
...
refs #6737
2019-04-24 11:51:17 +02:00
Alexander A. Klimov
622f684124
StreamLogger#BindStream(): set #m_FlushLogTimer only if needed
...
refs #6737
2019-04-24 11:47:02 +02:00
Elias Ohm
52e3db279a
Fix for double-free (and possibly other memory-corruption related) crashes at logrotate time
...
this is a direct fix of the issue revealing the problem that leads to crash
verification done with a patched icinga2 where the execution-order of the code lines of counter-parts involved in re-incrementing/decrementing Timer:Ptr is forced to be the one that leads to the obeserverd segfaults
refs #6737
2019-04-24 11:42:54 +02:00
Michael Friedrich
856877d1fe
Merge pull request #7134 from Icinga/feature/boost-asio-influxdbwriter
...
Use new I/O engine in InfluxdbWriter
2019-04-23 14:31:42 +02:00
Michael Friedrich
0f804d126b
Merge pull request #7133 from Icinga/feature/boost-asio-pki
...
Use new I/O engine in PkiUtility::FetchCert() and PkiUtility::RequestCertificate()
2019-04-23 14:27:48 +02:00
Michael Friedrich
dee8fbf248
Merge pull request #7128 from Icinga/feature/re-write-objectlock-7123
...
Re-write ObjectLock's implementation details
2019-04-23 11:53:40 +02:00
Alexander A. Klimov
c1fa07899c
Introduce OptionalTlsStream
2019-04-23 11:25:26 +02:00
Alexander A. Klimov
d8c9fdf1d4
Make Object#m_Mutex std::recursive_mutex
...
refs #7123
2019-04-17 18:26:29 +02:00
Alexander A. Klimov
7e6868bc99
Make Object#m_LockOwner std::atomic<std: 🧵 :id>
...
refs #7123
2019-04-17 18:26:23 +02:00
Alexander A. Klimov
f9f998334d
ObjectLock: deduplicate constructors
...
refs #7123
2019-04-17 16:47:41 +02:00
Alexander A. Klimov
5afda77943
Namespace: place ObjectLock in all methods
2019-04-16 17:38:58 +02:00
Michael Friedrich
b906714254
Fix that MaxConcurrentChecks constant is overridden from 'checker' feature
...
Note: This drops the deprecated concurrent_checks setting from the checker feature
entirely and refactors the underlaying code handling.
Also affects ReloadTimeout which is new for 2.11.
fixes #7111
2019-04-16 15:04:57 +02:00
Michael Friedrich
c2f180395a
Merge pull request #7000 from Icinga/bugfix/goto-loop
...
Don't abuse goto for building simple loops
2019-04-03 09:46:17 +02:00
Alexander A. Klimov
cfd0d86b9b
Use C++11 atomics for our intrusive pointers
2019-04-02 13:54:30 +02:00
Alexander A. Klimov
f4a78380e9
Add non-async overloads for NetString::ReadStringFromStream() and NetString::WriteStringToStream()
2019-04-01 17:11:10 +02:00
Alexander A. Klimov
d1e87bdc45
Connect(): add non-async overload
2019-04-01 17:11:09 +02:00
Alexander A. Klimov
f2d9d91e83
Introduce UnbufferedAsioTlsStream#GetPeerCertificate()
2019-04-01 17:11:09 +02:00
Alexander A. Klimov
d428bdf384
Add missing includes
2019-04-01 13:31:16 +02:00
Alexander A. Klimov
bf23e5392b
UnbufferedAsioTlsStream: don't rely on *this in decltype()s for methods' return types
2019-04-01 13:31:16 +02:00
Alexander A. Klimov
7ec1e638a8
Turn shortcut UnbufferedAsioTlsStream::Parent into a base class
2019-04-01 13:31:16 +02:00
Alexander A. Klimov
e6d78bf361
Move some TCP/TLS logic out of ApiListener
...
... for re-using it
2019-04-01 13:31:16 +02:00
Alexander A. Klimov
79220ee647
io-engine.hpp: fix missing namespace
2019-04-01 13:31:16 +02:00
Alexander A. Klimov
8b3efe5759
Introduce AsioConditionVariable
2019-04-01 13:31:16 +02:00
Alexander A. Klimov
d3392d1579
Rename AsioTlsStreamHack to UnbufferedAsioTlsStream
2019-04-01 13:31:16 +02:00
Alexander A. Klimov
b384f859c9
Make IoEngine::m_CpuBoundSemaphore signed
2019-04-01 13:31:16 +02:00
Alexander A. Klimov
e26774c7f8
IoEngine: adjust I/O threads
2019-04-01 13:31:16 +02:00
Alexander A. Klimov
b26808414c
NetString::ReadStringFromStream(): add Boost ASIO overload
2019-04-01 11:40:14 +02:00
Alexander A. Klimov
43658de529
NetString::WriteStringToStream(): add Boost ASIO overload
2019-04-01 11:40:14 +02:00
Alexander A. Klimov
282f8fd173
IoEngine: explicitly join I/O threads
2019-04-01 11:40:14 +02:00
Alexander A. Klimov
ac72ca4ae6
Don't warn that Boost.Coroutine v1 is deprecated
2019-04-01 11:40:14 +02:00
Alexander A. Klimov
d7b465ce74
Implement IoBoundWorkSlot
2019-04-01 11:40:14 +02:00
Alexander A. Klimov
2d7714802d
Allow CpuBoundWork to be done before end of scope
2019-04-01 11:40:14 +02:00
Alexander A. Klimov
e21956e26e
ApiListener: detect protocol
2019-04-01 11:40:14 +02:00
Alexander A. Klimov
2615967e7f
Make ApiListener#m_SSLContext a Boost ASIO SSL context
2019-04-01 11:40:14 +02:00
Alexander A. Klimov
c547e9a863
Implement basic I/O engine
2019-04-01 11:40:14 +02:00
Alexander A. Klimov
7c7c5e28f5
Implement LazyInit<T>
2019-04-01 11:40:14 +02:00
Michael Friedrich
149f640fd8
Improve DB IDO HA failover behaviour
...
- Decrease Object Authority updates to 10s (was 30s)
- Decrease failover timeout to 30s (was 60s)
- Decrease cold startup (after (re)start) with no OA updates to 30s (was 60s)
- Immediately connect on Resume()
- Fix query priority which got broken with #6970
- Add more logging when a failover is in progress
```
[2019-03-29 16:13:53 +0100] information/IdoMysqlConnection: Last update by endpoint 'master1' was 8.33246s ago (< failover timeout of 30s). Retrying.
[2019-03-29 16:14:23 +0100] information/IdoMysqlConnection: Last update by endpoint 'master1' was 38.3288s ago. Taking over 'ido-mysql' in HA zone 'master'.
```
- Add more logging for reconnect and disconnect handling
- Add 'last_failover' attribute to IDO*Connection objects
refs #6970
2019-04-01 08:50:00 +02:00
Michael Friedrich
6ace8001d8
Merge pull request #7019 from Icinga/feature/new-json-library
...
Replace YAJL with nlohmann::json
2019-03-18 17:26:57 +01:00
Alexander A. Klimov
0cf10c6306
Make buildable with VS 2017
2019-03-18 15:07:57 +01:00
Alexander A. Klimov
2a05b46431
Auto-sanitize data before en-/decoding JSON
2019-03-18 15:07:57 +01:00
Alexander A. Klimov
9daca0b216
Get rid of YAJL
2019-03-18 15:07:57 +01:00
Alexander A. Klimov
5882594b43
JsonEncode(): use nlohmann::json
2019-03-18 15:07:57 +01:00
Alexander A. Klimov
1b0367b740
JsonDecode(): use nlohmann::json::sax_parse()
2019-03-18 15:07:57 +01:00
Michael Friedrich
724b34c6f2
Integrate nlohmann_json into CMake
...
Better integration into base/json.cpp
Signed-off-by: Alexander A. Klimov <alexander.klimov@icinga.com>
2019-03-18 15:07:50 +01:00
Michael Friedrich
2de8bac588
Merge pull request #6990 from Icinga/bugfix/influxdbwriter-oom-6989
...
InfluxdbWriter: don't leak sockets
2019-03-18 14:38:04 +01:00
Michael Friedrich
ea80d93efc
Merge pull request #7014 from Icinga/feature/utf8cpp
...
Utility::ValidateUTF8(): use UTF8-CPP
2019-03-18 10:57:03 +01:00
Michael Friedrich
804c00ece5
Merge pull request #6999 from Icinga/bugfix/compiler-warnings
...
Suppress or fix compiler warnings
2019-03-18 08:44:30 +01:00
Alexander A. Klimov
a72f4db5c9
Utility::ValidateUTF8(): use UTF8-CPP
2019-03-15 13:34:20 +01:00
Michael Friedrich
026ed837ac
Merge pull request #6976 from Icinga/bugfix/so_reuseport-missing
...
Don't require OS headers to provide SO_REUSEPORT
2019-03-13 10:30:08 +01:00
Alexander A. Klimov
ac354f9e80
Don't abuse goto for building simple loops
2019-03-08 14:59:01 +01:00
Alexander A. Klimov
bf92e32496
Suppress or fix compiler warnings
2019-03-08 14:07:29 +01:00
Alexander A. Klimov
a9841a9197
Defer: ensure not to throw any exceptions out of a destructor
...
refs #6989
2019-03-01 14:29:35 +01:00
Michael Friedrich
e2df11520e
Merge pull request #6970 from Icinga/bugfix/perfdata-gaps
...
Improve reload handling for features (metric & queue flush, activation priority)
2019-02-26 15:38:15 +01:00
Alexander A. Klimov
bf0c68757f
Don't require OS headers to provide SO_REUSEPORT
2019-02-26 11:25:44 +01:00
Michael Friedrich
458f997a18
Replace Copyright header with a short version, part II
2019-02-25 15:09:36 +01:00
Michael Friedrich
d14a88235d
Replace Copyright header with a short version, part I
...
CLion -> replace in path
2019-02-25 14:48:22 +01:00
Michael Friedrich
ab7a799369
Implement ReloadTimeout constant and wait for enqueued checks on Stop()
2019-02-25 09:03:47 +01:00
Alexander A. Klimov
9558ebc0f4
Secure ApiUser::GetByAuthHeader() against timing attacks
2019-02-22 16:59:36 +01:00
Michael Friedrich
89634c2eb6
Re-add Defer functionality
2019-02-22 15:27:34 +01:00
Michael Friedrich
a25e2b1038
Stop object in reversed activation priority order
...
This stops the checker component first, then notifications, then
features, then config objects, then the API feature and logger(s).
Patch taken from @al2klimov
2019-02-20 12:38:57 +01:00
Michael Friedrich
5da1cbd096
Revert "Respect activation priority also on deactivation"
...
This reverts commit 8ad1717055
.
2019-02-19 14:30:44 +01:00
Michael Friedrich
a2f5b7a02c
Revert "CheckerComponent#Stop(): wait for all running checks"
...
This reverts commit 1eaad0637b
.
2019-02-19 14:05:00 +01:00
Michael Friedrich
d98c0704c4
Debug: Log calls to ConfigObject::Deactivate()
...
Only available in debug builds.
2019-02-19 13:49:52 +01:00
Michael Friedrich
0467c488e9
Merge pull request #6908 from Icinga/bugfix/perfdata-gaps
...
Ensure all perfdata to be written
2019-02-11 17:27:44 +01:00
Michael Friedrich
7a865aefd9
Merge pull request #6854 from Icinga/bugfix/unamehelper-inefficient-6452
...
Make UnameHelper() efficient
2019-02-11 16:57:17 +01:00
Alexander A. Klimov
8ad1717055
Respect activation priority also on deactivation
2019-02-06 11:17:45 +01:00
Michael Friedrich
4339240b46
Merge pull request #6858 from Icinga/feature/string-builder
...
Make string builder reusable
2019-02-04 16:05:20 +01:00
Michael Friedrich
77572c4424
Merge pull request #6901 from Icinga/bugfix/so_reuseport-6898
...
TcpSocket#Bind(): also set SO_REUSEPORT
2019-02-04 14:21:20 +01:00
Michael Friedrich
b58cb17e4b
Fix Convert::ToLong(double val)
2019-01-30 14:47:59 +01:00
Alexander A. Klimov
1eaad0637b
CheckerComponent#Stop(): wait for all running checks
2019-01-24 15:09:39 +01:00
Alexander A. Klimov
984f7be030
TcpSocket#Bind(): also set SO_REUSEPORT
...
refs #6898
2019-01-17 12:13:44 +01:00
Alexander A. Klimov
61860563a6
Make string builder reusable
2018-12-21 12:43:04 +01:00
Alexander A. Klimov
17e86f98a2
Make UnameHelper() efficient
...
refs #6452
2018-12-20 16:37:04 +01:00
Michael Friedrich
bf4ecbed69
Revert "ThreadPool#Stop(): discard non-processed queue items"
...
This reverts commit 30e6d0f809
.
refs #6815
2018-12-06 09:56:49 +01:00
Michael Friedrich
08c1539561
Merge pull request #6815 from Icinga/bugfix/reload-while-api-dos
...
ThreadPool#Stop(): discard non-processed queue items
2018-12-05 11:11:49 +01:00
Alexander A. Klimov
30e6d0f809
ThreadPool#Stop(): discard non-processed queue items
2018-12-03 16:38:52 +01:00
Michael Friedrich
f3cd3eb870
DSL: Implement getenv()
...
This patch also restores Utility::GetFromEnvironment()
and replaces the hardcoded `getenv()` calls.
2018-11-19 18:11:16 +01:00
Michael Friedrich
90de216cbb
Merge pull request #6479 from Icinga/feature/socketevents-inherit-object-6477
...
SocketEvents: inherit from Stream
2018-11-12 17:06:37 +01:00
Michael Friedrich
1f5555e1d6
Fix possible double free in StreamLogger::BindStream()
...
refs #6737
2018-11-08 15:51:58 +01:00
Alexander A. Klimov
a2ae01e64b
Socket engine: drop life support objects
...
refs #6477
2018-10-30 13:46:20 +01:00
Alexander A. Klimov
5134ccaf56
Make SocketEventDescriptor#EventInterface a SocketEvents::Ptr
...
refs #6477
2018-10-30 13:46:20 +01:00
Alexander A. Klimov
a9a9469868
SocketEvents: inherit from Stream
...
refs #6477
2018-10-30 13:46:20 +01:00
Michael Friedrich
5406ce6540
Ensure that API/JSON-RPC messages in the same session are processed and not stalled
...
This basically drops the "corked" implementation which just stalled the
TLS IO polling after some requests. If you need sort of rate limiting
for these events, use an external TLS proxy which terminates that in front
of Icinga.
fixes #6635
2018-10-29 12:57:24 +01:00
Michael Friedrich
7e1942e8e7
Merge pull request #6718 from Icinga/bugfix/ssl-shutdown
...
Call SSL_shutdown() at least twice
2018-10-24 11:46:32 +02:00
Michael Friedrich
dea5ec614e
icinga.com: Update CMakeLists.txt
2018-10-18 09:35:18 +02:00
Michael Friedrich
44c3b83769
icinga.com: Update '*.ti'
2018-10-18 09:30:00 +02:00
Michael Friedrich
dab53448bc
icinga.com: Update *.{h,c}pp
2018-10-18 09:27:04 +02:00
Michael Friedrich
af6c8a1f50
Add missing shutdown/program state dumps for SIGUSR2 reload handler
...
Credits to @west0rmann finding the issue and providing the initial fix.
fixes #6689
fixes #6592
2018-10-16 12:36:43 +02:00
Michael Friedrich
43a571e013
Don't throw an error when namespace indexers don't find a valid key
...
Examples:
```
globals["abc"]
globals.def
```
The patch for the Icinga Director unfortunately only solves the
master, and as discussed with @lippserd we need to ensure that
satellites and clients with 2.10 can be restarted without any errors
from deployed configuration.
refs #6509
refs icinga/icingaweb2-module-director#1654
2018-10-11 12:42:56 +02:00
Michael Friedrich
4be9f418a9
Revert "Initialize Socket Event Engine on application startup"
...
This reverts commit c8dcd1297f
.
We cannot do this during application startup, since Daemonize()
kills the threads again.
refs #6514
refs #6630
2018-10-09 19:38:29 +02:00
Michael Friedrich
96c0de9bea
Allow to override MaxConcurrentChecks constant
2018-09-27 20:23:00 +02:00
Michael Friedrich
c8dcd1297f
Initialize Socket Event Engine on application startup
...
Previously this happened inside the TlsStream constructor
during the first connection attempt.
2018-09-24 15:50:59 +02:00
Michael Friedrich
3038b150a9
Merge pull request #6616 from Icinga/feature/tls-handshake-timeout-config
...
Add ApiListener#tls_handshake_timeout option
2018-09-17 11:20:12 +02:00
Michael Friedrich
b81ac972b9
Silence compiler warning for nice()
2018-09-14 14:29:52 +02:00
Michael Friedrich
29701b4db5
Add ApiListener#tls_handshake_timeout option
...
This allows to specify the previously hardcoded
timeout of 10s.
refs #6517
2018-09-14 09:20:09 +02:00
Michael Friedrich
f297881e23
Call SSL_shutdown() at least twice
2018-09-10 16:10:16 +02:00