summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CHANGELOG.md93
-rw-r--r--Makefile.am184
-rw-r--r--collectors/ebpf.plugin/ebpf.c137
-rw-r--r--collectors/ebpf.plugin/ebpf_cachestat.c34
-rw-r--r--collectors/ebpf.plugin/ebpf_dcstat.c46
-rw-r--r--collectors/ebpf.plugin/ebpf_disk.c26
-rw-r--r--collectors/ebpf.plugin/ebpf_fd.c31
-rw-r--r--collectors/ebpf.plugin/ebpf_hardirq.c25
-rw-r--r--collectors/ebpf.plugin/ebpf_mdflush.c23
-rw-r--r--collectors/ebpf.plugin/ebpf_mount.c26
-rw-r--r--collectors/ebpf.plugin/ebpf_oomkill.c4
-rw-r--r--collectors/ebpf.plugin/ebpf_shm.c30
-rw-r--r--collectors/ebpf.plugin/ebpf_softirq.c26
-rw-r--r--collectors/ebpf.plugin/ebpf_swap.c29
-rw-r--r--collectors/ebpf.plugin/ebpf_sync.c33
-rw-r--r--collectors/ebpf.plugin/ebpf_vfs.c29
-rw-r--r--collectors/proc.plugin/proc_net_dev.c16
-rw-r--r--collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py17
-rwxr-xr-xcontrib/debian/install_go.sh156
-rw-r--r--database/sqlite/sqlite_health.c1
-rw-r--r--health/health.c23
-rw-r--r--libnetdata/socket/security.c151
-rw-r--r--libnetdata/socket/security.h1
-rw-r--r--libnetdata/socket/socket.c7
-rw-r--r--netdata.spec.in26
-rwxr-xr-xpackaging/makeself/install-or-update.sh13
-rw-r--r--packaging/version2
-rw-r--r--streaming/sender.c8
-rw-r--r--web/server/web_client.c6
29 files changed, 562 insertions, 641 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2f08eb7a4..607bb030a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,48 @@
# Changelog
+## [v1.40.1](https://github.com/netdata/netdata/tree/v1.40.1) (2023-06-27)
+
+[Full Changelog](https://github.com/netdata/netdata/compare/v1.40.0...v1.40.1)
+
+**Merged pull requests:**
+
+- Update libbpf version [\#15258](https://github.com/netdata/netdata/pull/15258) ([thiagoftsm](https://github.com/thiagoftsm))
+- Fix $\(libh2o\_dir\) not expanded properly sometimes. [\#15253](https://github.com/netdata/netdata/pull/15253) ([Dim-P](https://github.com/Dim-P))
+- use gperf for the pluginsd/streaming parser hashtable [\#15251](https://github.com/netdata/netdata/pull/15251) ([ktsaou](https://github.com/ktsaou))
+- Update pfsense.md package install instructions [\#15250](https://github.com/netdata/netdata/pull/15250) ([MYanello](https://github.com/MYanello))
+- URL rewrite at the agent web server to support multiple dashboard versions [\#15247](https://github.com/netdata/netdata/pull/15247) ([ktsaou](https://github.com/ktsaou))
+- delay collecting virtual network interfaces [\#15244](https://github.com/netdata/netdata/pull/15244) ([ilyam8](https://github.com/ilyam8))
+- Install the correct systemd unit file on older RPM systems. [\#15240](https://github.com/netdata/netdata/pull/15240) ([Ferroin](https://github.com/Ferroin))
+- Add module column to apps.plugin csv [\#15235](https://github.com/netdata/netdata/pull/15235) ([Ancairon](https://github.com/Ancairon))
+- Fix coverity 393183 & 393182 [\#15234](https://github.com/netdata/netdata/pull/15234) ([MrZammler](https://github.com/MrZammler))
+- Create index for health log migration [\#15233](https://github.com/netdata/netdata/pull/15233) ([stelfrag](https://github.com/stelfrag))
+- New alerts endpoint [\#15232](https://github.com/netdata/netdata/pull/15232) ([stelfrag](https://github.com/stelfrag))
+- fix not handling N/A value in python.d/nvidia\_smi [\#15231](https://github.com/netdata/netdata/pull/15231) ([ilyam8](https://github.com/ilyam8))
+- Fix handling of plugin ownership in static builds. [\#15230](https://github.com/netdata/netdata/pull/15230) ([Ferroin](https://github.com/Ferroin))
+- /api/v2 improvements [\#15227](https://github.com/netdata/netdata/pull/15227) ([ktsaou](https://github.com/ktsaou))
+- Remove erroneous space for unit [\#15226](https://github.com/netdata/netdata/pull/15226) ([ralphm](https://github.com/ralphm))
+- Relax jnfv2 caching [\#15224](https://github.com/netdata/netdata/pull/15224) ([ktsaou](https://github.com/ktsaou))
+- Fix /api/v2/contexts,nodes,nodes\_instances,q before match [\#15223](https://github.com/netdata/netdata/pull/15223) ([ktsaou](https://github.com/ktsaou))
+- Fix SSL non-blocking retry handling in the web server [\#15222](https://github.com/netdata/netdata/pull/15222) ([ktsaou](https://github.com/ktsaou))
+- Update dashboard to version v3.0.0. [\#15219](https://github.com/netdata/netdata/pull/15219) ([netdatabot](https://github.com/netdatabot))
+- fix arch detection on i386 \(native packages\) [\#15218](https://github.com/netdata/netdata/pull/15218) ([ilyam8](https://github.com/ilyam8))
+- RW\_SPINLOCK: recursive readers support [\#15217](https://github.com/netdata/netdata/pull/15217) ([ktsaou](https://github.com/ktsaou))
+- cgroups: remove pod\_uid and container\_id labels in k8s [\#15216](https://github.com/netdata/netdata/pull/15216) ([ilyam8](https://github.com/ilyam8))
+- Allow overriding pipename from env [\#15215](https://github.com/netdata/netdata/pull/15215) ([vkalintiris](https://github.com/vkalintiris))
+- Fix health crash [\#15209](https://github.com/netdata/netdata/pull/15209) ([stelfrag](https://github.com/stelfrag))
+- Fix file permissions under directory [\#15208](https://github.com/netdata/netdata/pull/15208) ([stelfrag](https://github.com/stelfrag))
+- RocketChat cloud integration docs [\#15205](https://github.com/netdata/netdata/pull/15205) ([car12o](https://github.com/car12o))
+- Obvious memory reductions [\#15204](https://github.com/netdata/netdata/pull/15204) ([ktsaou](https://github.com/ktsaou))
+- sqlite\_health.c: remove `uuid.h` include [\#15195](https://github.com/netdata/netdata/pull/15195) ([nandahkrishna](https://github.com/nandahkrishna))
+- RPM: Added elfutils-libelf-devel for build with eBPF \(again\) [\#15192](https://github.com/netdata/netdata/pull/15192) ([k0ste](https://github.com/k0ste))
+- Speed up eBPF exit before to bring functions [\#15187](https://github.com/netdata/netdata/pull/15187) ([thiagoftsm](https://github.com/thiagoftsm))
+- Add two functions that allow someone to start/stop ML. [\#15185](https://github.com/netdata/netdata/pull/15185) ([vkalintiris](https://github.com/vkalintiris))
+- Fix issues in sync thread \(eBPF plugin\) [\#15174](https://github.com/netdata/netdata/pull/15174) ([thiagoftsm](https://github.com/thiagoftsm))
+- /api/v2/nodes and streaming function [\#15168](https://github.com/netdata/netdata/pull/15168) ([ktsaou](https://github.com/ktsaou))
+- Use a single health log table [\#15157](https://github.com/netdata/netdata/pull/15157) ([MrZammler](https://github.com/MrZammler))
+- Redirect to index.html when a file is not found by web server [\#15143](https://github.com/netdata/netdata/pull/15143) ([MrZammler](https://github.com/MrZammler))
+- Consistently start the agent as root and rely on it to drop privileges properly. [\#14890](https://github.com/netdata/netdata/pull/14890) ([Ferroin](https://github.com/Ferroin))
+
## [v1.40.0](https://github.com/netdata/netdata/tree/v1.40.0) (2023-06-14)
[Full Changelog](https://github.com/netdata/netdata/compare/v1.39.1...v1.40.0)
@@ -98,7 +141,6 @@
- Remove old logic for handling of legacy stock config files. [\#14829](https://github.com/netdata/netdata/pull/14829) ([Ferroin](https://github.com/Ferroin))
- fix infiniband bytes counters multiplier and divisor [\#14748](https://github.com/netdata/netdata/pull/14748) ([ilyam8](https://github.com/ilyam8))
- New eBPF option [\#14691](https://github.com/netdata/netdata/pull/14691) ([thiagoftsm](https://github.com/thiagoftsm))
-- initial minimal h2o webserver integration [\#14585](https://github.com/netdata/netdata/pull/14585) ([underhood](https://github.com/underhood))
## [v1.39.1](https://github.com/netdata/netdata/tree/v1.39.1) (2023-05-18)
@@ -359,55 +401,6 @@
- Add Amazon Linux 2 to CI and platform support. [\#14599](https://github.com/netdata/netdata/pull/14599) ([Ferroin](https://github.com/Ferroin))
- Replace web server readme with its improved replica [\#14598](https://github.com/netdata/netdata/pull/14598) ([cakrit](https://github.com/cakrit))
- Update interact-new-charts.md [\#14596](https://github.com/netdata/netdata/pull/14596) ([cakrit](https://github.com/cakrit))
-- Fix context unittest coredump [\#14595](https://github.com/netdata/netdata/pull/14595) ([stelfrag](https://github.com/stelfrag))
-- Delete interact-dashboard-charts [\#14594](https://github.com/netdata/netdata/pull/14594) ([cakrit](https://github.com/cakrit))
-- /api/v2/contexts [\#14592](https://github.com/netdata/netdata/pull/14592) ([ktsaou](https://github.com/ktsaou))
-- Use vector allocation whenever is possible \(eBPF\) [\#14591](https://github.com/netdata/netdata/pull/14591) ([thiagoftsm](https://github.com/thiagoftsm))
-- Change link text to collectors.md [\#14590](https://github.com/netdata/netdata/pull/14590) ([cakrit](https://github.com/cakrit))
-- Add an option to the kickstart script to override distro detection. [\#14589](https://github.com/netdata/netdata/pull/14589) ([Ferroin](https://github.com/Ferroin))
-- Merge security documents [\#14588](https://github.com/netdata/netdata/pull/14588) ([cakrit](https://github.com/cakrit))
-- Prevent core dump when the agent is performing a quick shutdown [\#14587](https://github.com/netdata/netdata/pull/14587) ([stelfrag](https://github.com/stelfrag))
-- Clean host structure [\#14584](https://github.com/netdata/netdata/pull/14584) ([stelfrag](https://github.com/stelfrag))
-- Correct the sidebar position label metdata for learn [\#14583](https://github.com/netdata/netdata/pull/14583) ([cakrit](https://github.com/cakrit))
-- final install reorg for learn [\#14580](https://github.com/netdata/netdata/pull/14580) ([cakrit](https://github.com/cakrit))
-- Learn installation reorg part 2 [\#14579](https://github.com/netdata/netdata/pull/14579) ([cakrit](https://github.com/cakrit))
-- Add link to all installation options [\#14578](https://github.com/netdata/netdata/pull/14578) ([cakrit](https://github.com/cakrit))
-- Reorg learn 2102 1 [\#14577](https://github.com/netdata/netdata/pull/14577) ([cakrit](https://github.com/cakrit))
-- Update README.md [\#14576](https://github.com/netdata/netdata/pull/14576) ([cakrit](https://github.com/cakrit))
-- Reorg learn [\#14575](https://github.com/netdata/netdata/pull/14575) ([cakrit](https://github.com/cakrit))
-- Update static binary readme [\#14574](https://github.com/netdata/netdata/pull/14574) ([cakrit](https://github.com/cakrit))
-- Get update every from page [\#14573](https://github.com/netdata/netdata/pull/14573) ([stelfrag](https://github.com/stelfrag))
-- bump go.d to v0.51.0 [\#14572](https://github.com/netdata/netdata/pull/14572) ([ilyam8](https://github.com/ilyam8))
-- Remove References category from learn [\#14571](https://github.com/netdata/netdata/pull/14571) ([cakrit](https://github.com/cakrit))
-- Fix doc capitalization and remove obsolete section [\#14569](https://github.com/netdata/netdata/pull/14569) ([cakrit](https://github.com/cakrit))
-- Remove obsolete instruction to lower memory usage [\#14568](https://github.com/netdata/netdata/pull/14568) ([cakrit](https://github.com/cakrit))
-- Port ML from C++ to C. [\#14567](https://github.com/netdata/netdata/pull/14567) ([vkalintiris](https://github.com/vkalintiris))
-- Fix broken links in our documentation [\#14565](https://github.com/netdata/netdata/pull/14565) ([Ancairon](https://github.com/Ancairon))
-- /api/v2/data - multi-host/context/instance/dimension/label queries [\#14564](https://github.com/netdata/netdata/pull/14564) ([ktsaou](https://github.com/ktsaou))
-- pandas collector add `read_sql()` support [\#14563](https://github.com/netdata/netdata/pull/14563) ([andrewm4894](https://github.com/andrewm4894))
-- reviewed plans page to be according to latest updates [\#14560](https://github.com/netdata/netdata/pull/14560) ([hugovalente-pm](https://github.com/hugovalente-pm))
-- Fix kickstart link [\#14559](https://github.com/netdata/netdata/pull/14559) ([cakrit](https://github.com/cakrit))
-- Make secure nodes a category landing page [\#14558](https://github.com/netdata/netdata/pull/14558) ([cakrit](https://github.com/cakrit))
-- Add misc landing page and move proxy guides [\#14557](https://github.com/netdata/netdata/pull/14557) ([cakrit](https://github.com/cakrit))
-- Reorg learn 021723 [\#14556](https://github.com/netdata/netdata/pull/14556) ([cakrit](https://github.com/cakrit))
-- Update email notification docs with info about setup in Docker. [\#14555](https://github.com/netdata/netdata/pull/14555) ([Ferroin](https://github.com/Ferroin))
-- Fix broken links in integrations-overview [\#14554](https://github.com/netdata/netdata/pull/14554) ([Ancairon](https://github.com/Ancairon))
-- Add vnodes default configuration file. [\#14553](https://github.com/netdata/netdata/pull/14553) ([Ferroin](https://github.com/Ferroin))
-- RPM: Added elfutils-libelf-devel for build with eBPF [\#14552](https://github.com/netdata/netdata/pull/14552) ([k0ste](https://github.com/k0ste))
-- More reorg learn 021623 [\#14550](https://github.com/netdata/netdata/pull/14550) ([cakrit](https://github.com/cakrit))
-- Update learn path of python plugin readme [\#14549](https://github.com/netdata/netdata/pull/14549) ([cakrit](https://github.com/cakrit))
-- Hide netdata for IoT from learn. [\#14548](https://github.com/netdata/netdata/pull/14548) ([cakrit](https://github.com/cakrit))
-- Reorg markdown files for learn [\#14547](https://github.com/netdata/netdata/pull/14547) ([cakrit](https://github.com/cakrit))
-- Fix two issues with the edit-config script. [\#14545](https://github.com/netdata/netdata/pull/14545) ([Ferroin](https://github.com/Ferroin))
-- Reorganize system directory to better reflect what files are actually used for. [\#14544](https://github.com/netdata/netdata/pull/14544) ([Ferroin](https://github.com/Ferroin))
-- Fix coverity issues [\#14543](https://github.com/netdata/netdata/pull/14543) ([stelfrag](https://github.com/stelfrag))
-- Remove unused config options and functions [\#14542](https://github.com/netdata/netdata/pull/14542) ([stelfrag](https://github.com/stelfrag))
-- Add renamed markdown files [\#14540](https://github.com/netdata/netdata/pull/14540) ([cakrit](https://github.com/cakrit))
-- Fix broken svgs and improve database queries API doc [\#14539](https://github.com/netdata/netdata/pull/14539) ([cakrit](https://github.com/cakrit))
-- Reorganize learn documents under Integrations part 2 [\#14538](https://github.com/netdata/netdata/pull/14538) ([cakrit](https://github.com/cakrit))
-- Roles docs: Add Early Bird and Member role [\#14537](https://github.com/netdata/netdata/pull/14537) ([hugovalente-pm](https://github.com/hugovalente-pm))
-- Fix broken Alma Linux entries in build matrix generation. [\#14536](https://github.com/netdata/netdata/pull/14536) ([Ferroin](https://github.com/Ferroin))
-- Re-index when machine guid changes [\#14535](https://github.com/netdata/netdata/pull/14535) ([MrZammler](https://github.com/MrZammler))
## [v1.38.1](https://github.com/netdata/netdata/tree/v1.38.1) (2023-02-13)
diff --git a/Makefile.am b/Makefile.am
index 666847dc3..3fc97825e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -947,103 +947,101 @@ HTTPD_FILES = \
httpd/h2o_utils.h \
$(NULL)
-libh2o_dir = httpd/h2o
-
libh2o_a_SOURCES = \
- $(libh2o_dir)/deps/cloexec/cloexec.c \
- $(libh2o_dir)/deps/libgkc/gkc.c \
- $(libh2o_dir)/deps/libyrmcds/close.c \
- $(libh2o_dir)/deps/libyrmcds/connect.c \
- $(libh2o_dir)/deps/libyrmcds/recv.c \
- $(libh2o_dir)/deps/libyrmcds/send.c \
- $(libh2o_dir)/deps/libyrmcds/send_text.c \
- $(libh2o_dir)/deps/libyrmcds/socket.c \
- $(libh2o_dir)/deps/libyrmcds/strerror.c \
- $(libh2o_dir)/deps/libyrmcds/text_mode.c \
- $(libh2o_dir)/deps/picohttpparser/picohttpparser.c \
- $(libh2o_dir)/lib/common/cache.c \
- $(libh2o_dir)/lib/common/file.c \
- $(libh2o_dir)/lib/common/filecache.c \
- $(libh2o_dir)/lib/common/hostinfo.c \
- $(libh2o_dir)/lib/common/http1client.c \
- $(libh2o_dir)/lib/common/memcached.c \
- $(libh2o_dir)/lib/common/memory.c \
- $(libh2o_dir)/lib/common/multithread.c \
- $(libh2o_dir)/lib/common/serverutil.c \
- $(libh2o_dir)/lib/common/socket.c \
- $(libh2o_dir)/lib/common/socketpool.c \
- $(libh2o_dir)/lib/common/string.c \
- $(libh2o_dir)/lib/common/time.c \
- $(libh2o_dir)/lib/common/timeout.c \
- $(libh2o_dir)/lib/common/url.c \
- $(libh2o_dir)/lib/core/config.c \
- $(libh2o_dir)/lib/core/configurator.c \
- $(libh2o_dir)/lib/core/context.c \
- $(libh2o_dir)/lib/core/headers.c \
- $(libh2o_dir)/lib/core/logconf.c \
- $(libh2o_dir)/lib/core/proxy.c \
- $(libh2o_dir)/lib/core/request.c \
- $(libh2o_dir)/lib/core/token.c \
- $(libh2o_dir)/lib/core/util.c \
- $(libh2o_dir)/lib/handler/access_log.c \
- $(libh2o_dir)/lib/handler/chunked.c \
- $(libh2o_dir)/lib/handler/compress.c \
- $(libh2o_dir)/lib/handler/compress/gzip.c \
- $(libh2o_dir)/lib/handler/errordoc.c \
- $(libh2o_dir)/lib/handler/expires.c \
- $(libh2o_dir)/lib/handler/fastcgi.c \
- $(libh2o_dir)/lib/handler/file.c \
- $(libh2o_dir)/lib/handler/headers.c \
- $(libh2o_dir)/lib/handler/mimemap.c \
- $(libh2o_dir)/lib/handler/proxy.c \
- $(libh2o_dir)/lib/handler/redirect.c \
- $(libh2o_dir)/lib/handler/reproxy.c \
- $(libh2o_dir)/lib/handler/throttle_resp.c \
- $(libh2o_dir)/lib/handler/status.c \
- $(libh2o_dir)/lib/handler/headers_util.c \
- $(libh2o_dir)/lib/handler/status/events.c \
- $(libh2o_dir)/lib/handler/status/requests.c \
- $(libh2o_dir)/lib/handler/http2_debug_state.c \
- $(libh2o_dir)/lib/handler/status/durations.c \
- $(libh2o_dir)/lib/handler/configurator/access_log.c \
- $(libh2o_dir)/lib/handler/configurator/compress.c \
- $(libh2o_dir)/lib/handler/configurator/errordoc.c \
- $(libh2o_dir)/lib/handler/configurator/expires.c \
- $(libh2o_dir)/lib/handler/configurator/fastcgi.c \
- $(libh2o_dir)/lib/handler/configurator/file.c \
- $(libh2o_dir)/lib/handler/configurator/headers.c \
- $(libh2o_dir)/lib/handler/configurator/proxy.c \
- $(libh2o_dir)/lib/handler/configurator/redirect.c \
- $(libh2o_dir)/lib/handler/configurator/reproxy.c \
- $(libh2o_dir)/lib/handler/configurator/throttle_resp.c \
- $(libh2o_dir)/lib/handler/configurator/status.c \
- $(libh2o_dir)/lib/handler/configurator/http2_debug_state.c \
- $(libh2o_dir)/lib/handler/configurator/headers_util.c \
- $(libh2o_dir)/lib/http1.c \
- $(libh2o_dir)/lib/tunnel.c \
- $(libh2o_dir)/lib/http2/cache_digests.c \
- $(libh2o_dir)/lib/http2/casper.c \
- $(libh2o_dir)/lib/http2/connection.c \
- $(libh2o_dir)/lib/http2/frame.c \
- $(libh2o_dir)/lib/http2/hpack.c \
- $(libh2o_dir)/lib/http2/scheduler.c \
- $(libh2o_dir)/lib/http2/stream.c \
- $(libh2o_dir)/lib/http2/http2_debug_state.c \
+ httpd/h2o/deps/cloexec/cloexec.c \
+ httpd/h2o/deps/libgkc/gkc.c \
+ httpd/h2o/deps/libyrmcds/close.c \
+ httpd/h2o/deps/libyrmcds/connect.c \
+ httpd/h2o/deps/libyrmcds/recv.c \
+ httpd/h2o/deps/libyrmcds/send.c \
+ httpd/h2o/deps/libyrmcds/send_text.c \
+ httpd/h2o/deps/libyrmcds/socket.c \
+ httpd/h2o/deps/libyrmcds/strerror.c \
+ httpd/h2o/deps/libyrmcds/text_mode.c \
+ httpd/h2o/deps/picohttpparser/picohttpparser.c \
+ httpd/h2o/lib/common/cache.c \
+ httpd/h2o/lib/common/file.c \
+ httpd/h2o/lib/common/filecache.c \
+ httpd/h2o/lib/common/hostinfo.c \
+ httpd/h2o/lib/common/http1client.c \
+ httpd/h2o/lib/common/memcached.c \
+ httpd/h2o/lib/common/memory.c \
+ httpd/h2o/lib/common/multithread.c \
+ httpd/h2o/lib/common/serverutil.c \
+ httpd/h2o/lib/common/socket.c \
+ httpd/h2o/lib/common/socketpool.c \
+ httpd/h2o/lib/common/string.c \
+ httpd/h2o/lib/common/time.c \
+ httpd/h2o/lib/common/timeout.c \
+ httpd/h2o/lib/common/url.c \
+ httpd/h2o/lib/core/config.c \
+ httpd/h2o/lib/core/configurator.c \
+ httpd/h2o/lib/core/context.c \
+ httpd/h2o/lib/core/headers.c \
+ httpd/h2o/lib/core/logconf.c \
+ httpd/h2o/lib/core/proxy.c \
+ httpd/h2o/lib/core/request.c \
+ httpd/h2o/lib/core/token.c \
+ httpd/h2o/lib/core/util.c \
+ httpd/h2o/lib/handler/access_log.c \
+ httpd/h2o/lib/handler/chunked.c \
+ httpd/h2o/lib/handler/compress.c \
+ httpd/h2o/lib/handler/compress/gzip.c \
+ httpd/h2o/lib/handler/errordoc.c \
+ httpd/h2o/lib/handler/expires.c \
+ httpd/h2o/lib/handler/fastcgi.c \
+ httpd/h2o/lib/handler/file.c \
+ httpd/h2o/lib/handler/headers.c \
+ httpd/h2o/lib/handler/mimemap.c \
+ httpd/h2o/lib/handler/proxy.c \
+ httpd/h2o/lib/handler/redirect.c \
+ httpd/h2o/lib/handler/reproxy.c \
+ httpd/h2o/lib/handler/throttle_resp.c \
+ httpd/h2o/lib/handler/status.c \
+ httpd/h2o/lib/handler/headers_util.c \
+ httpd/h2o/lib/handler/status/events.c \
+ httpd/h2o/lib/handler/status/requests.c \
+ httpd/h2o/lib/handler/http2_debug_state.c \
+ httpd/h2o/lib/handler/status/durations.c \
+ httpd/h2o/lib/handler/configurator/access_log.c \
+ httpd/h2o/lib/handler/configurator/compress.c \
+ httpd/h2o/lib/handler/configurator/errordoc.c \
+ httpd/h2o/lib/handler/configurator/expires.c \
+ httpd/h2o/lib/handler/configurator/fastcgi.c \
+ httpd/h2o/lib/handler/configurator/file.c \
+ httpd/h2o/lib/handler/configurator/headers.c \
+ httpd/h2o/lib/handler/configurator/proxy.c \
+ httpd/h2o/lib/handler/configurator/redirect.c \
+ httpd/h2o/lib/handler/configurator/reproxy.c \
+ httpd/h2o/lib/handler/configurator/throttle_resp.c \
+ httpd/h2o/lib/handler/configurator/status.c \
+ httpd/h2o/lib/handler/configurator/http2_debug_state.c \
+ httpd/h2o/lib/handler/configurator/headers_util.c \
+ httpd/h2o/lib/http1.c \
+ httpd/h2o/lib/tunnel.c \
+ httpd/h2o/lib/http2/cache_digests.c \
+ httpd/h2o/lib/http2/casper.c \
+ httpd/h2o/lib/http2/connection.c \
+ httpd/h2o/lib/http2/frame.c \
+ httpd/h2o/lib/http2/hpack.c \
+ httpd/h2o/lib/http2/scheduler.c \
+ httpd/h2o/lib/http2/stream.c \
+ httpd/h2o/lib/http2/http2_debug_state.c \
$(NULL)
libh2o_a_INCLUDES = \
- -I$(srcdir)/$(libh2o_dir)/include \
- -I$(srcdir)/$(libh2o_dir)/deps/cloexec \
- -I$(srcdir)/$(libh2o_dir)/deps/brotli/enc \
- -I$(srcdir)/$(libh2o_dir)/deps/golombset \
- -I$(srcdir)/$(libh2o_dir)/deps/libgkc \
- -I$(srcdir)/$(libh2o_dir)/deps/libyrmcds \
- -I$(srcdir)/$(libh2o_dir)/deps/klib \
- -I$(srcdir)/$(libh2o_dir)/deps/neverbleed \
- -I$(srcdir)/$(libh2o_dir)/deps/picohttpparser \
- -I$(srcdir)/$(libh2o_dir)/deps/picotest \
- -I$(srcdir)/$(libh2o_dir)/deps/yaml/include \
- -I$(srcdir)/$(libh2o_dir)/deps/yoml \
+ -I$(srcdir)/httpd/h2o/include \
+ -I$(srcdir)/httpd/h2o/deps/cloexec \
+ -I$(srcdir)/httpd/h2o/deps/brotli/enc \
+ -I$(srcdir)/httpd/h2o/deps/golombset \
+ -I$(srcdir)/httpd/h2o/deps/libgkc \
+ -I$(srcdir)/httpd/h2o/deps/libyrmcds \
+ -I$(srcdir)/httpd/h2o/deps/klib \
+ -I$(srcdir)/httpd/h2o/deps/neverbleed \
+ -I$(srcdir)/httpd/h2o/deps/picohttpparser \
+ -I$(srcdir)/httpd/h2o/deps/picotest \
+ -I$(srcdir)/httpd/h2o/deps/yaml/include \
+ -I$(srcdir)/httpd/h2o/deps/yoml \
$(NULL)
if ENABLE_HTTPD
diff --git a/collectors/ebpf.plugin/ebpf.c b/collectors/ebpf.plugin/ebpf.c
index 45303574f..ffab37de3 100644
--- a/collectors/ebpf.plugin/ebpf.c
+++ b/collectors/ebpf.plugin/ebpf.c
@@ -540,6 +540,31 @@ ARAL *ebpf_allocate_pid_aral(char *name, size_t size)
*****************************************************************/
/**
+ * Wait to avoid possible coredumps while process is closing.
+ */
+static inline void ebpf_check_before2go()
+{
+ int i = EBPF_OPTION_ALL_CHARTS;
+ usec_t max = USEC_PER_SEC, step = 200000;
+ while (i && max) {
+ max -= step;
+ sleep_usec(step);
+ i = 0;
+ int j;
+ pthread_mutex_lock(&ebpf_exit_cleanup);
+ for (j = 0; ebpf_modules[j].thread_name != NULL; j++) {
+ if (ebpf_modules[j].enabled == NETDATA_THREAD_EBPF_RUNNING)
+ i++;
+ }
+ pthread_mutex_unlock(&ebpf_exit_cleanup);
+ }
+
+ if (i) {
+ error("eBPF cannot unload all threads on time, but it will go away");
+ }
+}
+
+/**
* Close the collector gracefully
*/
static void ebpf_exit()
@@ -561,8 +586,10 @@ static void ebpf_exit()
#ifdef NETDATA_INTERNAL_CHECKS
error("Good bye world! I was PID %d", main_thread_id);
#endif
- printf("DISABLE\n");
+ fprintf(stdout, "EXIT\n");
+ fflush(stdout);
+ ebpf_check_before2go();
pthread_mutex_lock(&mutex_cgroup_shm);
if (shm_ebpf_cgroup.header) {
ebpf_unmap_cgroup_shared_memory();
@@ -604,6 +631,10 @@ static void ebpf_unload_unique_maps()
{
int i;
for (i = 0; ebpf_modules[i].thread_name; i++) {
+ // These threads are cleaned with other functions
+ if (i > EBPF_MODULE_SOCKET_IDX)
+ continue;
+
if (ebpf_modules[i].enabled != NETDATA_THREAD_EBPF_STOPPED) {
if (ebpf_modules[i].enabled != NETDATA_THREAD_EBPF_NOT_RUNNING)
error("Cannot unload maps for thread %s, because it is not stopped.", ebpf_modules[i].thread_name);
@@ -611,73 +642,18 @@ static void ebpf_unload_unique_maps()
continue;
}
- ebpf_unload_legacy_code(ebpf_modules[i].objects, ebpf_modules[i].probe_links);
- switch (i) {
- case EBPF_MODULE_CACHESTAT_IDX: {
-#ifdef LIBBPF_MAJOR_VERSION
- if (cachestat_bpf_obj)
- cachestat_bpf__destroy(cachestat_bpf_obj);
-#endif
- break;
- }
- case EBPF_MODULE_DCSTAT_IDX: {
-#ifdef LIBBPF_MAJOR_VERSION
- if (dc_bpf_obj)
- dc_bpf__destroy(dc_bpf_obj);
-#endif
- break;
- }
- case EBPF_MODULE_FD_IDX: {
-#ifdef LIBBPF_MAJOR_VERSION
- if (fd_bpf_obj)
- fd_bpf__destroy(fd_bpf_obj);
-#endif
- break;
- }
- case EBPF_MODULE_MOUNT_IDX: {
-#ifdef LIBBPF_MAJOR_VERSION
- if (mount_bpf_obj)
- mount_bpf__destroy(mount_bpf_obj);
-#endif
- break;
- }
- case EBPF_MODULE_SHM_IDX: {
-#ifdef LIBBPF_MAJOR_VERSION
- if (shm_bpf_obj)
- shm_bpf__destroy(shm_bpf_obj);
-#endif
- break;
- }
- case EBPF_MODULE_SOCKET_IDX: {
-#ifdef LIBBPF_MAJOR_VERSION
- if (socket_bpf_obj)
- socket_bpf__destroy(socket_bpf_obj);
-#endif
- break;
- }
- case EBPF_MODULE_SWAP_IDX: {
-#ifdef LIBBPF_MAJOR_VERSION
- if (bpf_obj)
- swap_bpf__destroy(bpf_obj);
-#endif
- break;
- }
- case EBPF_MODULE_VFS_IDX: {
+ if (ebpf_modules[i].load == EBPF_LOAD_LEGACY) {
+ ebpf_unload_legacy_code(ebpf_modules[i].objects, ebpf_modules[i].probe_links);
+ continue;
+ }
+
+ if (i == EBPF_MODULE_SOCKET_IDX) {
#ifdef LIBBPF_MAJOR_VERSION
- if (vfs_bpf_obj)
- vfs_bpf__destroy(vfs_bpf_obj);
+ if (socket_bpf_obj)
+ socket_bpf__destroy(socket_bpf_obj);
#endif
- break;
- }
- case EBPF_MODULE_PROCESS_IDX:
- case EBPF_MODULE_DISK_IDX:
- case EBPF_MODULE_HARDIRQ_IDX:
- case EBPF_MODULE_SOFTIRQ_IDX:
- case EBPF_MODULE_OOMKILL_IDX:
- case EBPF_MODULE_MDFLUSH_IDX:
- default:
- continue;
}
+
}
}
@@ -689,11 +665,15 @@ static void ebpf_unload_unique_maps()
static void ebpf_unload_filesystems()
{
if (ebpf_modules[EBPF_MODULE_FILESYSTEM_IDX].enabled == NETDATA_THREAD_EBPF_NOT_RUNNING ||
- ebpf_modules[EBPF_MODULE_SYNC_IDX].enabled == NETDATA_THREAD_EBPF_RUNNING)
+ ebpf_modules[EBPF_MODULE_FILESYSTEM_IDX].enabled == NETDATA_THREAD_EBPF_RUNNING ||
+ ebpf_modules[EBPF_MODULE_FILESYSTEM_IDX].load != EBPF_LOAD_LEGACY)
return;
int i;
for (i = 0; localfs[i].filesystem != NULL; i++) {
+ if (!localfs[i].objects)
+ continue;
+
ebpf_unload_legacy_code(localfs[i].objects, localfs[i].probe_links);
}
}
@@ -711,6 +691,15 @@ static void ebpf_unload_sync()
int i;
for (i = 0; local_syscalls[i].syscall != NULL; i++) {
+ if (!local_syscalls[i].enabled)
+ continue;
+
+#ifdef LIBBPF_MAJOR_VERSION
+ if (local_syscalls[i].sync_obj) {
+ sync_bpf__destroy(local_syscalls[i].sync_obj);
+ continue;
+ }
+#endif
ebpf_unload_legacy_code(local_syscalls[i].objects, local_syscalls[i].probe_links);
}
}
@@ -753,19 +742,7 @@ static void ebpf_stop_threads(int sig)
ebpf_exit_plugin = 1;
- usec_t max = USEC_PER_SEC, step = 100000;
- while (i && max) {
- max -= step;
- sleep_usec(step);
- i = 0;
- int j;
- pthread_mutex_lock(&ebpf_exit_cleanup);
- for (j = 0; ebpf_modules[j].thread_name != NULL; j++) {
- if (ebpf_modules[j].enabled == NETDATA_THREAD_EBPF_RUNNING)
- i++;
- }
- pthread_mutex_unlock(&ebpf_exit_cleanup);
- }
+ ebpf_check_before2go();
pthread_mutex_lock(&ebpf_exit_cleanup);
ebpf_unload_unique_maps();
@@ -2650,7 +2627,7 @@ int main(int argc, char **argv)
(void)heartbeat_next(&hb, step);
pthread_mutex_lock(&ebpf_exit_cleanup);
- if (ebpf_modules[i].enabled == NETDATA_THREAD_EBPF_RUNNING && process_pid_fd != -1) {
+ if (process_pid_fd != -1) {
pthread_mutex_lock(&collect_data_mutex);
if (++update_apps_list == update_apps_every) {
update_apps_list = 0;
diff --git a/collectors/ebpf.plugin/ebpf_cachestat.c b/collectors/ebpf.plugin/ebpf_cachestat.c
index 5bbbe1f43..c287136cf 100644
--- a/collectors/ebpf.plugin/ebpf_cachestat.c
+++ b/collectors/ebpf.plugin/ebpf_cachestat.c
@@ -337,27 +337,6 @@ static inline int ebpf_cachestat_load_and_attach(struct cachestat_bpf *obj, ebpf
*****************************************************************/
/**
- * Cachestat Free
- *
- * Cleanup variables after child threads to stop
- *
- * @param ptr thread data.
- */
-static void ebpf_cachestat_free(ebpf_module_t *em)
-{
- pthread_mutex_lock(&ebpf_exit_cleanup);
- em->enabled = NETDATA_THREAD_EBPF_STOPPING;
- pthread_mutex_unlock(&ebpf_exit_cleanup);
-
- freez(cachestat_vector);
- freez(cachestat_values);
-
- pthread_mutex_lock(&ebpf_exit_cleanup);
- em->enabled = NETDATA_THREAD_EBPF_STOPPED;
- pthread_mutex_unlock(&ebpf_exit_cleanup);
-}
-
-/**
* Cachestat exit.
*
* Cancel child and exit.
@@ -368,7 +347,18 @@ static void ebpf_cachestat_exit(void *ptr)
{
ebpf_module_t *em = (ebpf_module_t *)ptr;
- ebpf_cachestat_free(em);
+#ifdef LIBBPF_MAJOR_VERSION
+ if (cachestat_bpf_obj)
+ cachestat_bpf__destroy(cachestat_bpf_obj);
+#endif
+
+ if (em->objects) {
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
+ }
+
+ pthread_mutex_lock(&ebpf_exit_cleanup);
+ em->enabled = NETDATA_THREAD_EBPF_STOPPED;
+ pthread_mutex_unlock(&ebpf_exit_cleanup);
}
/*****************************************************************
diff --git a/collectors/ebpf.plugin/ebpf_dcstat.c b/collectors/ebpf.plugin/ebpf_dcstat.c
index 5a07e4619..4157f0c87 100644
--- a/collectors/ebpf.plugin/ebpf_dcstat.c
+++ b/collectors/ebpf.plugin/ebpf_dcstat.c
@@ -286,55 +286,29 @@ void dcstat_update_publish(netdata_publish_dcstat_t *out, uint64_t cache_access,
*****************************************************************/
/**
- * Clean names
- *
- * Clean the optional names allocated during startup.
- */
-void ebpf_dcstat_clean_names()
-{
- size_t i = 0;
- while (dc_optional_name[i].program_name) {
- freez(dc_optional_name[i].optional);
- i++;
- }
-}
-
-/**
- * DCstat Free
+ * DCstat exit
*
- * Cleanup variables after child threads to stop
+ * Cancel child and exit.
*
* @param ptr thread data.
*/
-static void ebpf_dcstat_free(ebpf_module_t *em )
+static void ebpf_dcstat_exit(void *ptr)
{
- pthread_mutex_lock(&ebpf_exit_cleanup);
- em->enabled = NETDATA_THREAD_EBPF_STOPPING;
- pthread_mutex_unlock(&ebpf_exit_cleanup);
+ ebpf_module_t *em = (ebpf_module_t *)ptr;
- freez(dcstat_vector);
- freez(dcstat_values);
+#ifdef LIBBPF_MAJOR_VERSION
+ if (dc_bpf_obj)
+ dc_bpf__destroy(dc_bpf_obj);
+#endif
- ebpf_dcstat_clean_names();
+ if (em->objects)
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
pthread_mutex_lock(&ebpf_exit_cleanup);
em->enabled = NETDATA_THREAD_EBPF_STOPPED;
pthread_mutex_unlock(&ebpf_exit_cleanup);
}
-/**
- * DCstat exit
- *
- * Cancel child and exit.
- *
- * @param ptr thread data.
- */
-static void ebpf_dcstat_exit(void *ptr)
-{
- ebpf_module_t *em = (ebpf_module_t *)ptr;
- ebpf_dcstat_free(em);
-}
-
/*****************************************************************
*
* APPS
diff --git a/collectors/ebpf.plugin/ebpf_disk.c b/collectors/ebpf.plugin/ebpf_disk.c
index 71c972777..231186b84 100644
--- a/collectors/ebpf.plugin/ebpf_disk.c
+++ b/collectors/ebpf.plugin/ebpf_disk.c
@@ -435,17 +435,18 @@ static void ebpf_cleanup_disk_list()
}
/**
- * DISK Free
+ * Disk exit.
*
- * Cleanup variables after child threads to stop
+ * Cancel child and exit.
*
* @param ptr thread data.
*/
-static void ebpf_disk_free(ebpf_module_t *em)
+static void ebpf_disk_exit(void *ptr)
{
- pthread_mutex_lock(&ebpf_exit_cleanup);
- em->enabled = NETDATA_THREAD_EBPF_STOPPING;
- pthread_mutex_unlock(&ebpf_exit_cleanup);
+ ebpf_module_t *em = (ebpf_module_t *)ptr;
+
+ if (em->objects)
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
ebpf_disk_disable_tracepoints();
@@ -463,19 +464,6 @@ static void ebpf_disk_free(ebpf_module_t *em)
pthread_mutex_unlock(&ebpf_exit_cleanup);
}
-/**
- * Disk exit.
- *
- * Cancel child and exit.
- *
- * @param ptr thread data.
- */
-static void ebpf_disk_exit(void *ptr)
-{
- ebpf_module_t *em = (ebpf_module_t *)ptr;
- ebpf_disk_free(em);
-}
-
/*****************************************************************
*
* MAIN LOOP
diff --git a/collectors/ebpf.plugin/ebpf_fd.c b/collectors/ebpf.plugin/ebpf_fd.c
index 6d3868952..d39e6ae20 100644
--- a/collectors/ebpf.plugin/ebpf_fd.c
+++ b/collectors/ebpf.plugin/ebpf_fd.c
@@ -370,39 +370,28 @@ static inline int ebpf_fd_load_and_attach(struct fd_bpf *obj, ebpf_module_t *em)
*****************************************************************/
/**
- * FD Free
+ * FD Exit
*
- * Cleanup variables after child threads to stop
+ * Cancel child thread and exit.
*
* @param ptr thread data.
*/
-static void ebpf_fd_free(ebpf_module_t *em)
+static void ebpf_fd_exit(void *ptr)
{
- pthread_mutex_lock(&ebpf_exit_cleanup);
- em->enabled = NETDATA_THREAD_EBPF_STOPPING;
- pthread_mutex_unlock(&ebpf_exit_cleanup);
+ ebpf_module_t *em = (ebpf_module_t *)ptr;
- freez(fd_values);
- freez(fd_vector);
+#ifdef LIBBPF_MAJOR_VERSION
+ if (fd_bpf_obj)
+ fd_bpf__destroy(fd_bpf_obj);
+#endif
+ if (em->objects)
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
pthread_mutex_lock(&ebpf_exit_cleanup);
em->enabled = NETDATA_THREAD_EBPF_STOPPED;
pthread_mutex_unlock(&ebpf_exit_cleanup);
}
-/**
- * FD Exit
- *
- * Cancel child thread and exit.
- *
- * @param ptr thread data.
- */
-static void ebpf_fd_exit(void *ptr)
-{
- ebpf_module_t *em = (ebpf_module_t *)ptr;
- ebpf_fd_free(em);
-}
-
/*****************************************************************
*
* MAIN LOOP
diff --git a/collectors/ebpf.plugin/ebpf_hardirq.c b/collectors/ebpf.plugin/ebpf_hardirq.c
index 113648ec9..f714c261c 100644
--- a/collectors/ebpf.plugin/ebpf_hardirq.c
+++ b/collectors/ebpf.plugin/ebpf_hardirq.c
@@ -188,35 +188,28 @@ void ebpf_hardirq_release(hardirq_val_t *stat)
*****************************************************************/
/**
- * Hardirq Free
+ * Hardirq Exit
*
- * Cleanup variables after child threads to stop
+ * Cancel child and exit.
*
* @param ptr thread data.
*/
-static void ebpf_hardirq_free(ebpf_module_t *em)
+static void hardirq_exit(void *ptr)
{
+ ebpf_module_t *em = (ebpf_module_t *)ptr;
+
+ if (em->objects)
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
+
for (int i = 0; hardirq_tracepoints[i].class != NULL; i++) {
ebpf_disable_tracepoint(&hardirq_tracepoints[i]);
}
+
pthread_mutex_lock(&ebpf_exit_cleanup);
em->enabled = NETDATA_THREAD_EBPF_STOPPED;
pthread_mutex_unlock(&ebpf_exit_cleanup);
}
-/**
- * Hardirq Exit
- *
- * Cancel child and exit.
- *
- * @param ptr thread data.
- */
-static void hardirq_exit(void *ptr)
-{
- ebpf_module_t *em = (ebpf_module_t *)ptr;
- ebpf_hardirq_free(em);
-}
-
/*****************************************************************
* MAIN LOOP
*****************************************************************/
diff --git a/collectors/ebpf.plugin/ebpf_mdflush.c b/collectors/ebpf.plugin/ebpf_mdflush.c
index 321bd97ee..65ed860a4 100644
--- a/collectors/ebpf.plugin/ebpf_mdflush.c
+++ b/collectors/ebpf.plugin/ebpf_mdflush.c
@@ -39,21 +39,6 @@ static avl_tree_lock mdflush_pub;
static mdflush_ebpf_val_t *mdflush_ebpf_vals = NULL;
/**
- * MDflush Free
- *
- * Cleanup variables after child threads to stop
- *
- * @param ptr thread data.
- */
-static void ebpf_mdflush_free(ebpf_module_t *em)
-{
- freez(mdflush_ebpf_vals);
- pthread_mutex_lock(&ebpf_exit_cleanup);
- em->enabled = NETDATA_THREAD_EBPF_STOPPED;
- pthread_mutex_unlock(&ebpf_exit_cleanup);
-}
-
-/**
* MDflush exit
*
* Cancel thread and exit.
@@ -63,7 +48,13 @@ static void ebpf_mdflush_free(ebpf_module_t *em)
static void mdflush_exit(void *ptr)
{
ebpf_module_t *em = (ebpf_module_t *)ptr;
- ebpf_mdflush_free(em);
+
+ if (em->objects)
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
+
+ pthread_mutex_lock(&ebpf_exit_cleanup);
+ em->enabled = NETDATA_THREAD_EBPF_STOPPED;
+ pthread_mutex_unlock(&ebpf_exit_cleanup);
}
/**
diff --git a/collectors/ebpf.plugin/ebpf_mount.c b/collectors/ebpf.plugin/ebpf_mount.c
index e0951f8c4..e48c89227 100644
--- a/collectors/ebpf.plugin/ebpf_mount.c
+++ b/collectors/ebpf.plugin/ebpf_mount.c
@@ -223,20 +223,6 @@ static inline int ebpf_mount_load_and_attach(struct mount_bpf *obj, ebpf_module_
*****************************************************************/
/**
- * Mount Free
- *
- * Cleanup variables after child threads to stop
- *
- * @param ptr thread data.
- */
-static void ebpf_mount_free(ebpf_module_t *em)
-{
- pthread_mutex_lock(&ebpf_exit_cleanup);
- em->enabled = NETDATA_THREAD_EBPF_STOPPED;
- pthread_mutex_unlock(&ebpf_exit_cleanup);
-}
-
-/**
* Mount Exit
*
* Cancel child thread.
@@ -246,7 +232,17 @@ static void ebpf_mount_free(ebpf_module_t *em)
static void ebpf_mount_exit(void *ptr)
{
ebpf_module_t *em = (ebpf_module_t *)ptr;
- ebpf_mount_free(em);
+
+#ifdef LIBBPF_MAJOR_VERSION
+ if (mount_bpf_obj)
+ mount_bpf__destroy(mount_bpf_obj);
+#endif
+ if (em->objects)
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
+
+ pthread_mutex_lock(&ebpf_exit_cleanup);
+ em->enabled = NETDATA_THREAD_EBPF_STOPPED;
+ pthread_mutex_unlock(&ebpf_exit_cleanup);
}
/*****************************************************************
diff --git a/collectors/ebpf.plugin/ebpf_oomkill.c b/collectors/ebpf.plugin/ebpf_oomkill.c
index 094875292..c80f44873 100644
--- a/collectors/ebpf.plugin/ebpf_oomkill.c
+++ b/collectors/ebpf.plugin/ebpf_oomkill.c
@@ -52,6 +52,10 @@ static netdata_publish_syscall_t oomkill_publish_aggregated = {.name = "oomkill"
static void oomkill_cleanup(void *ptr)
{
ebpf_module_t *em = (ebpf_module_t *)ptr;
+
+ if (em->objects)
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
+
pthread_mutex_lock(&ebpf_exit_cleanup);
em->enabled = NETDATA_THREAD_EBPF_STOPPED;
pthread_mutex_unlock(&ebpf_exit_cleanup);
diff --git a/collectors/ebpf.plugin/ebpf_shm.c b/collectors/ebpf.plugin/ebpf_shm.c
index 093d65b60..94ac624b3 100644
--- a/collectors/ebpf.plugin/ebpf_shm.c
+++ b/collectors/ebpf.plugin/ebpf_shm.c
@@ -289,23 +289,6 @@ static inline int ebpf_shm_load_and_attach(struct shm_bpf *obj, ebpf_module_t *e
*****************************************************************/
/**
- * SHM Free
- *
- * Cleanup variables after child threads to stop
- *
- * @param ptr thread data.
- */
-static void ebpf_shm_free(ebpf_module_t *em)
-{
- freez(shm_vector);
- freez(shm_values);
-
- pthread_mutex_lock(&ebpf_exit_cleanup);
- em->enabled = NETDATA_THREAD_EBPF_STOPPED;
- pthread_mutex_unlock(&ebpf_exit_cleanup);
-}
-
-/**
* SHM Exit
*
* Cancel child thread.
@@ -315,7 +298,18 @@ static void ebpf_shm_free(ebpf_module_t *em)
static void ebpf_shm_exit(void *ptr)
{
ebpf_module_t *em = (ebpf_module_t *)ptr;
- ebpf_shm_free(em);
+
+#ifdef LIBBPF_MAJOR_VERSION
+ if (shm_bpf_obj)
+ shm_bpf__destroy(shm_bpf_obj);
+#endif
+
+ if (em->objects)
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
+
+ pthread_mutex_lock(&ebpf_exit_cleanup);
+ em->enabled = NETDATA_THREAD_EBPF_STOPPED;
+ pthread_mutex_unlock(&ebpf_exit_cleanup);
}
/*****************************************************************
diff --git a/collectors/ebpf.plugin/ebpf_softirq.c b/collectors/ebpf.plugin/ebpf_softirq.c
index 01e2d0a52..b5c77bf06 100644
--- a/collectors/ebpf.plugin/ebpf_softirq.c
+++ b/collectors/ebpf.plugin/ebpf_softirq.c
@@ -61,17 +61,18 @@ static softirq_val_t softirq_vals[] = {
static softirq_ebpf_val_t *softirq_ebpf_vals = NULL;
/**
- * Cachestat Free
+ * Cleanup
*
- * Cleanup variables after child threads to stop
+ * Clean up allocated memory.
*
* @param ptr thread data.
*/
-static void ebpf_softirq_free(ebpf_module_t *em)
+static void softirq_cleanup(void *ptr)
{
- pthread_mutex_lock(&ebpf_exit_cleanup);
- em->enabled = NETDATA_THREAD_EBPF_STOPPING;
- pthread_mutex_unlock(&ebpf_exit_cleanup);
+ ebpf_module_t *em = (ebpf_module_t *)ptr;
+
+ if (em->objects)
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
for (int i = 0; softirq_tracepoints[i].class != NULL; i++) {
ebpf_disable_tracepoint(&softirq_tracepoints[i]);
@@ -83,19 +84,6 @@ static void ebpf_softirq_free(ebpf_module_t *em)
pthread_mutex_unlock(&ebpf_exit_cleanup);
}
-/**
- * Cleanup
- *
- * Clean up allocated memory.
- *
- * @param ptr thread data.
- */
-static void softirq_cleanup(void *ptr)
-{
- ebpf_module_t *em = (ebpf_module_t *)ptr;
- ebpf_softirq_free(em);
-}
-
/*****************************************************************
* MAIN LOOP
*****************************************************************/
diff --git a/collectors/ebpf.plugin/ebpf_swap.c b/collectors/ebpf.plugin/ebpf_swap.c
index c9129a3fa..492b59678 100644
--- a/collectors/ebpf.plugin/ebpf_swap.c
+++ b/collectors/ebpf.plugin/ebpf_swap.c
@@ -230,23 +230,6 @@ static inline int ebpf_swap_load_and_attach(struct swap_bpf *obj, ebpf_module_t
*****************************************************************/
/**
- * Cachestat Free
- *
- * Cleanup variables after child threads to stop
- *
- * @param ptr thread data.
- */
-static void ebpf_swap_free(ebpf_module_t *em)
-{
- freez(swap_vector);
- freez(swap_values);
-
- pthread_mutex_lock(&ebpf_exit_cleanup);
- em->enabled = NETDATA_THREAD_EBPF_STOPPED;
- pthread_mutex_unlock(&ebpf_exit_cleanup);
-}
-
-/**
* Swap exit
*
* Cancel thread and exit.
@@ -256,7 +239,17 @@ static void ebpf_swap_free(ebpf_module_t *em)
static void ebpf_swap_exit(void *ptr)
{
ebpf_module_t *em = (ebpf_module_t *)ptr;
- ebpf_swap_free(em);
+
+#ifdef LIBBPF_MAJOR_VERSION
+ if (bpf_obj)
+ swap_bpf__destroy(bpf_obj);
+#endif
+ if (em->objects)
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
+
+ pthread_mutex_lock(&ebpf_exit_cleanup);
+ em->enabled = NETDATA_THREAD_EBPF_STOPPED;
+ pthread_mutex_unlock(&ebpf_exit_cleanup);
}
/*****************************************************************
diff --git a/collectors/ebpf.plugin/ebpf_sync.c b/collectors/ebpf.plugin/ebpf_sync.c
index 66e9c742c..9f1c0159d 100644
--- a/collectors/ebpf.plugin/ebpf_sync.c
+++ b/collectors/ebpf.plugin/ebpf_sync.c
@@ -349,6 +349,7 @@ static int ebpf_sync_initialize_syscall(ebpf_module_t *em)
for (i = 0; local_syscalls[i].syscall; i++) {
ebpf_sync_syscalls_t *w = &local_syscalls[i];
w->sync_maps = local_syscalls[i].sync_maps;
+ em->maps = local_syscalls[i].sync_maps;
if (w->enabled) {
if (em->load & EBPF_LOAD_LEGACY) {
if (ebpf_sync_load_legacy(w, em))
@@ -360,20 +361,23 @@ static int ebpf_sync_initialize_syscall(ebpf_module_t *em)
else {
char syscall[NETDATA_EBPF_MAX_SYSCALL_LENGTH];
ebpf_select_host_prefix(syscall, NETDATA_EBPF_MAX_SYSCALL_LENGTH, w->syscall, running_on_kernel);
- w->sync_obj = sync_bpf__open();
- if (!w->sync_obj) {
- errors++;
- } else {
- if (ebpf_is_function_inside_btf(default_btf, syscall)) {
+ if (ebpf_is_function_inside_btf(default_btf, syscall)) {
+ w->sync_obj = sync_bpf__open();
+ if (!w->sync_obj) {
+ w->enabled = false;
+ errors++;
+ } else {
if (ebpf_sync_load_and_attach(w->sync_obj, em, syscall, i)) {
+ w->enabled = false;
errors++;
}
- } else {
- if (ebpf_sync_load_legacy(w, em))
- errors++;
}
- em->thread_name = saved_name;
+ } else {
+ info("Cannot find syscall %s we are not going to monitor it.", syscall);
+ w->enabled = false;
}
+
+ em->thread_name = saved_name;
}
#endif
}
@@ -402,7 +406,7 @@ static int ebpf_sync_initialize_syscall(ebpf_module_t *em)
*/
static void ebpf_sync_read_global_table(int maps_per_core)
{
- netdata_idx_t stored[ebpf_nprocs];
+ netdata_idx_t stored[NETDATA_MAX_PROCESSOR];
uint32_t idx = NETDATA_SYNC_CALL;
int i;
for (i = 0; local_syscalls[i].syscall; i++) {
@@ -456,7 +460,7 @@ static void ebpf_send_sync_chart(char *id,
*/
static void sync_send_data()
{
- if (local_syscalls[NETDATA_SYNC_FSYNC_IDX].enabled || local_syscalls[NETDATA_SYNC_FDATASYNC_IDX].enabled) {
+ if (local_syscalls[NETDATA_SYNC_FSYNC_IDX].enabled && local_syscalls[NETDATA_SYNC_FDATASYNC_IDX].enabled) {
ebpf_send_sync_chart(NETDATA_EBPF_FILE_SYNC_CHART, NETDATA_SYNC_FSYNC_IDX, NETDATA_SYNC_FDATASYNC_IDX);
}
@@ -465,7 +469,7 @@ static void sync_send_data()
sync_counter_publish_aggregated[NETDATA_SYNC_MSYNC_IDX].dimension,
sync_hash_values[NETDATA_SYNC_MSYNC_IDX]);
- if (local_syscalls[NETDATA_SYNC_SYNC_IDX].enabled || local_syscalls[NETDATA_SYNC_SYNCFS_IDX].enabled) {
+ if (local_syscalls[NETDATA_SYNC_SYNC_IDX].enabled && local_syscalls[NETDATA_SYNC_SYNCFS_IDX].enabled) {
ebpf_send_sync_chart(NETDATA_EBPF_SYNC_CHART, NETDATA_SYNC_SYNC_IDX, NETDATA_SYNC_SYNCFS_IDX);
}
@@ -551,7 +555,7 @@ static void ebpf_create_sync_chart(char *id,
*/
static void ebpf_create_sync_charts(int update_every)
{
- if (local_syscalls[NETDATA_SYNC_FSYNC_IDX].enabled || local_syscalls[NETDATA_SYNC_FDATASYNC_IDX].enabled)
+ if (local_syscalls[NETDATA_SYNC_FSYNC_IDX].enabled && local_syscalls[NETDATA_SYNC_FDATASYNC_IDX].enabled)
ebpf_create_sync_chart(NETDATA_EBPF_FILE_SYNC_CHART,
"Monitor calls for <code>fsync(2)</code> and <code>fdatasync(2)</code>.", 21300,
NETDATA_SYNC_FSYNC_IDX, NETDATA_SYNC_FDATASYNC_IDX, update_every);
@@ -561,7 +565,7 @@ static void ebpf_create_sync_charts(int update_every)
"Monitor calls for <code>msync(2)</code>.", 21301,
NETDATA_SYNC_MSYNC_IDX, NETDATA_SYNC_MSYNC_IDX, update_every);
- if (local_syscalls[NETDATA_SYNC_SYNC_IDX].enabled || local_syscalls[NETDATA_SYNC_SYNCFS_IDX].enabled)
+ if (local_syscalls[NETDATA_SYNC_SYNC_IDX].enabled && local_syscalls[NETDATA_SYNC_SYNCFS_IDX].enabled)
ebpf_create_sync_chart(NETDATA_EBPF_SYNC_CHART,
"Monitor calls for <code>sync(2)</code> and <code>syncfs(2)</code>.", 21302,
NETDATA_SYNC_SYNC_IDX, NETDATA_SYNC_SYNCFS_IDX, update_every);
@@ -616,7 +620,6 @@ void *ebpf_sync_thread(void *ptr)
netdata_thread_cleanup_push(ebpf_sync_exit, ptr);
ebpf_module_t *em = (ebpf_module_t *)ptr;
- em->maps = sync_maps;
ebpf_set_sync_maps();
ebpf_sync_parse_syscalls();
diff --git a/collectors/ebpf.plugin/ebpf_vfs.c b/collectors/ebpf.plugin/ebpf_vfs.c
index bfc7ee8f7..6cafafc38 100644
--- a/collectors/ebpf.plugin/ebpf_vfs.c
+++ b/collectors/ebpf.plugin/ebpf_vfs.c
@@ -404,23 +404,6 @@ static inline int ebpf_vfs_load_and_attach(struct vfs_bpf *obj, ebpf_module_t *e
*****************************************************************/
/**
- * Cachestat Free
- *
- * Cleanup variables after child threads to stop
- *
- * @param ptr thread data.
- */
-static void ebpf_vfs_free(ebpf_module_t *em)
-{
- freez(vfs_hash_values);
- freez(vfs_vector);
-
- pthread_mutex_lock(&ebpf_exit_cleanup);
- em->enabled = NETDATA_THREAD_EBPF_STOPPED;
- pthread_mutex_unlock(&ebpf_exit_cleanup);
-}
-
-/**
* Exit
*
* Cancel thread and exit.
@@ -430,7 +413,17 @@ static void ebpf_vfs_free(ebpf_module_t *em)
static void ebpf_vfs_exit(void *ptr)
{
ebpf_module_t *em = (ebpf_module_t *)ptr;
- ebpf_vfs_free(em);
+
+#ifdef LIBBPF_MAJOR_VERSION
+ if (vfs_bpf_obj)
+ vfs_bpf__destroy(vfs_bpf_obj);
+#endif
+ if (em->objects)
+ ebpf_unload_legacy_code(em->objects, em->probe_links);
+
+ pthread_mutex_lock(&ebpf_exit_cleanup);
+ em->enabled = NETDATA_THREAD_EBPF_STOPPED;
+ pthread_mutex_unlock(&ebpf_exit_cleanup);
}
/*****************************************************************
diff --git a/collectors/proc.plugin/proc_net_dev.c b/collectors/proc.plugin/proc_net_dev.c
index 9e8127cb6..16881d170 100644
--- a/collectors/proc.plugin/proc_net_dev.c
+++ b/collectors/proc.plugin/proc_net_dev.c
@@ -57,6 +57,8 @@ static struct netdev {
int configured;
int enabled;
int updated;
+
+ time_t discover_time;
int carrier_file_exists;
time_t carrier_file_lost_time;
@@ -529,6 +531,7 @@ static inline void netdev_rename(struct netdev *d) {
if(unlikely(r && !r->processed)) {
netdev_rename_cgroup(d, r);
r->processed = 1;
+ d->discover_time = 0;
netdev_pending_renames--;
}
}
@@ -671,6 +674,8 @@ static struct netdev *get_netdev(const char *name) {
return d;
}
+#define NETDEV_VIRTUAL_COLLECT_DELAY 15 // 1 full run of the cgroups discovery thread (10 secs by default)
+
int do_proc_net_dev(int update_every, usec_t dt) {
(void)dt;
static SIMPLE_PATTERN *disabled_list = NULL;
@@ -747,6 +752,8 @@ int do_proc_net_dev(int update_every, usec_t dt) {
kernel_uint_t system_rbytes = 0;
kernel_uint_t system_tbytes = 0;
+ time_t now = now_realtime_sec();
+
size_t lines = procfile_lines(ff), l;
for(l = 2; l < lines ;l++) {
// require 17 words on each line
@@ -765,6 +772,7 @@ int do_proc_net_dev(int update_every, usec_t dt) {
// remember we configured it
d->configured = 1;
+ d->discover_time = now;
d->enabled = enable_new_interfaces;
@@ -826,6 +834,14 @@ int do_proc_net_dev(int update_every, usec_t dt) {
if(unlikely(!d->enabled))
continue;
+ // See https://github.com/netdata/netdata/issues/15206
+ // This is necessary to prevent the creation of charts for virtual interfaces that will later be
+ // recreated as container interfaces (create container) or
+ // rediscovered and recreated only to be deleted almost immediately (stop/remove container)
+ if (d->virtual && (now - d->discover_time < NETDEV_VIRTUAL_COLLECT_DELAY)) {
+ continue;
+ }
+
if(likely(d->do_bandwidth != CONFIG_BOOLEAN_NO || !d->virtual)) {
d->rbytes = str2kernel_uint_t(procfile_lineword(ff, l, 1));
d->tbytes = str2kernel_uint_t(procfile_lineword(ff, l, 9));
diff --git a/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py b/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py
index 6affae7b8..271c99638 100644
--- a/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py
+++ b/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py
@@ -17,6 +17,8 @@ disabled_by_default = True
NVIDIA_SMI = 'nvidia-smi'
+NOT_AVAILABLE = 'N/A'
+
EMPTY_ROW = ''
EMPTY_ROW_LIMIT = 500
POLLER_BREAK_ROW = '</nvidia_smi_log>'
@@ -481,13 +483,14 @@ class GPU:
'power_draw': self.power_draw(),
}
- pci_bw_max = self.pci_bw_max()
- if not pci_bw_max:
- data['rx_util_percent'] = 0
- data['tx_util_percent'] = 0
- else :
- data['rx_util_percent'] = str(int(int(self.rx_util())*100/self.pci_bw_max()))
- data['tx_util_percent'] = str(int(int(self.tx_util())*100/self.pci_bw_max()))
+ if self.rx_util() != NOT_AVAILABLE and self.tx_util() != NOT_AVAILABLE:
+ pci_bw_max = self.pci_bw_max()
+ if not pci_bw_max:
+ data['rx_util_percent'] = 0
+ data['tx_util_percent'] = 0
+ else:
+ data['rx_util_percent'] = str(int(int(self.rx_util()) * 100 / self.pci_bw_max()))
+ data['tx_util_percent'] = str(int(int(self.tx_util()) * 100 / self.pci_bw_max()))
for v in POWER_STATES:
diff --git a/contrib/debian/install_go.sh b/contrib/debian/install_go.sh
index 4c4ee9394..f39bd1bce 100755
--- a/contrib/debian/install_go.sh
+++ b/contrib/debian/install_go.sh
@@ -7,92 +7,88 @@ LIBEXEC_DIR="$3"
# ############################################################
# Package Go within netdata (TBD: Package it separately)
safe_sha256sum() {
- # Within the context of the installer, we only use -c option that is common between the two commands
- # We will have to reconsider if we start non-common options
- if command -v sha256sum >/dev/null 2>&1; then
- sha256sum $@
- elif command -v shasum >/dev/null 2>&1; then
- shasum -a 256 $@
- else
- fatal "I could not find a suitable checksum binary to use"
- fi
+ # Within the context of the installer, we only use -c option that is common between the two commands
+ # We will have to reconsider if we start non-common options
+ if command -v sha256sum >/dev/null 2>&1; then
+ sha256sum $@
+ elif command -v shasum >/dev/null 2>&1; then
+ shasum -a 256 $@
+ else
+ fatal "I could not find a suitable checksum binary to use"
+ fi
}
download_go() {
- url="${1}"
- dest="${2}"
-
- if command -v curl >/dev/null 2>&1; then
- curl -sSL --connect-timeout 10 --retry 3 "${url}" > "${dest}"
- elif command -v wget >/dev/null 2>&1; then
- wget -T 15 -O - "${url}" > "${dest}"
- else
- echo >&2
- echo >&2 "Downloading go.d plugin from '${url}' failed because of missing mandatory packages."
- echo >&2 "Either add packages or disable it by issuing '--disable-go' in the installer"
- echo >&2
- exit 1
- fi
+ url="${1}"
+ dest="${2}"
+
+ if command -v curl >/dev/null 2>&1; then
+ curl -sSL --connect-timeout 10 --retry 3 "${url}" >"${dest}"
+ elif command -v wget >/dev/null 2>&1; then
+ wget -T 15 -O - "${url}" >"${dest}"
+ else
+ echo >&2
+ echo >&2 "Downloading go.d plugin from '${url}' failed because of missing mandatory packages."
+ echo >&2 "Either add packages or disable it by issuing '--disable-go' in the installer"
+ echo >&2
+ exit 1
+ fi
}
install_go() {
- ARCH_MAP=(
- 'i386::386'
- 'i686::386'
- 'x86_64::amd64'
- 'aarch64::arm64'
- 'armv64::arm64'
- 'armv6l::arm'
- 'armv7l::arm'
- 'armv5tel::arm'
- )
-
- if [ -z "${NETDATA_DISABLE_GO+x}" ]; then
- echo >&2 "Install go.d.plugin"
- ARCH=$(uname -m)
- OS=$(uname -s | tr '[:upper:]' '[:lower:]')
-
- for index in "${ARCH_MAP[@]}" ; do
- KEY="${index%%::*}"
- VALUE="${index##*::}"
- if [ "$KEY" = "$ARCH" ]; then
- ARCH="${VALUE}"
- break
- fi
- done
- tmp=$(mktemp -d /tmp/netdata-go-XXXXXX)
- GO_PACKAGE_BASENAME="go.d.plugin-${GO_PACKAGE_VERSION}.${OS}-${ARCH}.tar.gz"
- download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/${GO_PACKAGE_BASENAME}" "${tmp}/${GO_PACKAGE_BASENAME}"
- download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/config.tar.gz" "${tmp}/config.tar.gz"
-
- if [ ! -f "${tmp}/${GO_PACKAGE_BASENAME}" ] || [ ! -f "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/${GO_PACKAGE_BASENAME}" ]; then
- echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
- echo >&2
- return 1
- fi
-
- grep "${GO_PACKAGE_BASENAME}\$" "packaging/go.d.checksums" > "${tmp}/sha256sums.txt" 2>/dev/null
- grep "config.tar.gz" "packaging/go.d.checksums" >> "${tmp}/sha256sums.txt" 2>/dev/null
-
- # Checksum validation
- if ! (cd "${tmp}" && safe_sha256sum -c "sha256sums.txt"); then
-
- echo >&2 "go.d plugin checksum validation failure."
- echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
- echo >&2
-
- echo "go.d.plugin package files checksum validation failed."
- exit 1
- fi
-
- # Install files
- tar -xf "${tmp}/config.tar.gz" -C "${LIB_DIR}/conf.d/"
- tar xf "${tmp}/${GO_PACKAGE_BASENAME}"
- mv "${GO_PACKAGE_BASENAME/\.tar\.gz/}" "${LIBEXEC_DIR}/plugins.d/go.d.plugin"
-
- rm -rf "${tmp}"
- fi
- return 0
+ ARCH_MAP=(
+ 'i386::386'
+ 'armhf::arm'
+ )
+ if [ -z "${NETDATA_DISABLE_GO+x}" ]; then
+ ARCH="${DEB_TARGET_ARCH}"
+
+ for index in "${ARCH_MAP[@]}" ; do
+ KEY="${index%%::*}"
+ VALUE="${index##*::}"
+ if [ "$KEY" = "$ARCH" ]; then
+ ARCH="${VALUE}"
+ break
+ fi
+ done
+
+ OS=$(uname -s | tr '[:upper:]' '[:lower:]')
+
+ echo >&2 "Install go.d.plugin (ARCH=${ARCH}, OS=${OS})"
+
+ tmp=$(mktemp -d /tmp/netdata-go-XXXXXX)
+ GO_PACKAGE_BASENAME="go.d.plugin-${GO_PACKAGE_VERSION}.${OS}-${ARCH}.tar.gz"
+ download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/${GO_PACKAGE_BASENAME}" "${tmp}/${GO_PACKAGE_BASENAME}"
+ download_go "https://github.com/netdata/go.d.plugin/releases/download/${GO_PACKAGE_VERSION}/config.tar.gz" "${tmp}/config.tar.gz"
+
+ if [ ! -f "${tmp}/${GO_PACKAGE_BASENAME}" ] || [ ! -f "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/config.tar.gz" ] || [ ! -s "${tmp}/${GO_PACKAGE_BASENAME}" ]; then
+ echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
+ echo >&2
+ return 1
+ fi
+
+ grep "${GO_PACKAGE_BASENAME}\$" "packaging/go.d.checksums" >"${tmp}/sha256sums.txt" 2>/dev/null
+ grep "config.tar.gz" "packaging/go.d.checksums" >>"${tmp}/sha256sums.txt" 2>/dev/null
+
+ # Checksum validation
+ if ! (cd "${tmp}" && safe_sha256sum -c "sha256sums.txt"); then
+
+ echo >&2 "go.d plugin checksum validation failure."
+ echo >&2 "Either check the error or consider disabling it by issuing '--disable-go' in the installer"
+ echo >&2
+
+ echo "go.d.plugin package files checksum validation failed."
+ exit 1
+ fi
+
+ # Install files
+ tar -xf "${tmp}/config.tar.gz" -C "${LIB_DIR}/conf.d/"
+ tar xf "${tmp}/${GO_PACKAGE_BASENAME}"
+ mv "${GO_PACKAGE_BASENAME/\.tar\.gz/}" "${LIBEXEC_DIR}/plugins.d/go.d.plugin"
+
+ rm -rf "${tmp}"
+ fi
+ return 0
}
install_go
diff --git a/database/sqlite/sqlite_health.c b/database/sqlite/sqlite_health.c
index aedbf1108..5c4cdbbd3 100644
--- a/database/sqlite/sqlite_health.c
+++ b/database/sqlite/sqlite_health.c
@@ -3,7 +3,6 @@
#include "sqlite_health.h"
#include "sqlite_functions.h"
#include "sqlite_db_migration.h"
-#include "uuid.h"
#define MAX_HEALTH_SQL_SIZE 2048
#define sqlite3_bind_string_or_null(res,key,param) ((key) ? sqlite3_bind_text(res, param, string2str(key), -1, SQLITE_STATIC) : sqlite3_bind_null(res, param))
diff --git a/health/health.c b/health/health.c
index df4798a20..e04debb93 100644
--- a/health/health.c
+++ b/health/health.c
@@ -628,8 +628,9 @@ static inline void health_alarm_log_process(RRDHOST *host) {
//delete those that are updated, no in progress execution, and is not repeating
netdata_rwlock_wrlock(&host->health_log.alarm_log_rwlock);
- ALARM_ENTRY *prev = host->health_log.alarms;
- for(ae = host->health_log.alarms; ae ; ae = ae->next) {
+ ALARM_ENTRY *prev = NULL, *next = NULL;
+ for(ae = host->health_log.alarms; ae ; ae = next) {
+ next = ae->next; // set it here, for the next iteration
if((likely(!(ae->flags & HEALTH_ENTRY_FLAG_IS_REPEATING)) &&
(ae->flags & HEALTH_ENTRY_FLAG_UPDATED) &&
@@ -641,15 +642,19 @@ static inline void health_alarm_log_process(RRDHOST *host) {
(ae->when + 3600 < now_realtime_sec())))
{
- if (ae == host->health_log.alarms) {
- host->health_log.alarms = ae->next;
- prev = ae->next;
- } else {
- prev->next = ae->next;
+ if(host->health_log.alarms == ae) {
+ host->health_log.alarms = next;
+ // prev is also NULL here
+ }
+ else {
+ prev->next = next;
+ // prev should not be touched here - we need it for the next iteration
+ // because we may have to also remove the next item
}
+
health_alarm_log_free_one_nochecks_nounlink(ae);
- ae = prev;
- } else
+ }
+ else
prev = ae;
}
diff --git a/libnetdata/socket/security.c b/libnetdata/socket/security.c
index d1181ad5f..abae71c66 100644
--- a/libnetdata/socket/security.c
+++ b/libnetdata/socket/security.c
@@ -23,80 +23,19 @@ static SOCKET_PEERS netdata_ssl_peers(NETDATA_SSL *ssl) {
return socket_peers(sock_fd);
}
-bool netdata_ssl_open(NETDATA_SSL *ssl, SSL_CTX *ctx, int fd) {
- errno = 0;
- ssl->ssl_errno = 0;
-
- if(ssl->conn) {
- if(!ctx || SSL_get_SSL_CTX(ssl->conn) != ctx) {
- SSL_free(ssl->conn);
- ssl->conn = NULL;
- }
- else if (SSL_clear(ssl->conn) == 0) {
- netdata_ssl_log_error_queue("SSL_clear", ssl);
- SSL_free(ssl->conn);
- ssl->conn = NULL;
- }
- }
-
- if(!ssl->conn) {
- if(!ctx) {
- internal_error(true, "SSL: not CTX given");
- ssl->state = NETDATA_SSL_STATE_FAILED;
- return false;
- }
-
- ssl->conn = SSL_new(ctx);
- if (!ssl->conn) {
- netdata_ssl_log_error_queue("SSL_new", ssl);
- ssl->state = NETDATA_SSL_STATE_FAILED;
- return false;
- }
- }
-
- if(SSL_set_fd(ssl->conn, fd) != 1) {
- netdata_ssl_log_error_queue("SSL_set_fd", ssl);
- ssl->state = NETDATA_SSL_STATE_FAILED;
- return false;
- }
-
- ssl->state = NETDATA_SSL_STATE_INIT;
-
- ERR_clear_error();
-
- return true;
-}
-
-void netdata_ssl_close(NETDATA_SSL *ssl) {
- errno = 0;
- ssl->ssl_errno = 0;
-
- if(ssl->conn) {
- if(SSL_connection(ssl)) {
- int ret = SSL_shutdown(ssl->conn);
- if(ret == 0)
- SSL_shutdown(ssl->conn);
- }
+static void netdata_ssl_log_error_queue(const char *call, NETDATA_SSL *ssl, unsigned long err) {
+ error_limit_static_thread_var(erl, 1, 0);
- SSL_free(ssl->conn);
+ if(err == SSL_ERROR_NONE)
+ err = ERR_get_error();
- ERR_clear_error();
- }
-
- *ssl = NETDATA_SSL_UNSET_CONNECTION;
-}
+ if(err == SSL_ERROR_NONE)
+ return;
-void netdata_ssl_log_error_queue(const char *call, NETDATA_SSL *ssl) {
- error_limit_static_thread_var(erl, 1, 0);
- unsigned long err;
- while((err = ERR_get_error())) {
+ do {
char *code;
switch (err) {
- case SSL_ERROR_NONE:
- code = "SSL_ERROR_NONE";
- break;
-
case SSL_ERROR_SSL:
code = "SSL_ERROR_SSL";
ssl->state = NETDATA_SSL_STATE_FAILED;
@@ -166,7 +105,71 @@ void netdata_ssl_log_error_queue(const char *call, NETDATA_SSL *ssl) {
SOCKET_PEERS peers = netdata_ssl_peers(ssl);
error_limit(&erl, "SSL: %s() on socket local [[%s]:%d] <-> remote [[%s]:%d], returned error %lu (%s): %s",
call, peers.local.ip, peers.local.port, peers.peer.ip, peers.peer.port, err, code, str);
+
+ } while((err = ERR_get_error()));
+}
+
+bool netdata_ssl_open(NETDATA_SSL *ssl, SSL_CTX *ctx, int fd) {
+ errno = 0;
+ ssl->ssl_errno = 0;
+
+ if(ssl->conn) {
+ if(!ctx || SSL_get_SSL_CTX(ssl->conn) != ctx) {
+ SSL_free(ssl->conn);
+ ssl->conn = NULL;
+ }
+ else if (SSL_clear(ssl->conn) == 0) {
+ netdata_ssl_log_error_queue("SSL_clear", ssl, SSL_ERROR_NONE);
+ SSL_free(ssl->conn);
+ ssl->conn = NULL;
+ }
+ }
+
+ if(!ssl->conn) {
+ if(!ctx) {
+ internal_error(true, "SSL: not CTX given");
+ ssl->state = NETDATA_SSL_STATE_FAILED;
+ return false;
+ }
+
+ ssl->conn = SSL_new(ctx);
+ if (!ssl->conn) {
+ netdata_ssl_log_error_queue("SSL_new", ssl, SSL_ERROR_NONE);
+ ssl->state = NETDATA_SSL_STATE_FAILED;
+ return false;
+ }
}
+
+ if(SSL_set_fd(ssl->conn, fd) != 1) {
+ netdata_ssl_log_error_queue("SSL_set_fd", ssl, SSL_ERROR_NONE);
+ ssl->state = NETDATA_SSL_STATE_FAILED;
+ return false;
+ }
+
+ ssl->state = NETDATA_SSL_STATE_INIT;
+
+ ERR_clear_error();
+
+ return true;
+}
+
+void netdata_ssl_close(NETDATA_SSL *ssl) {
+ errno = 0;
+ ssl->ssl_errno = 0;
+
+ if(ssl->conn) {
+ if(SSL_connection(ssl)) {
+ int ret = SSL_shutdown(ssl->conn);
+ if(ret == 0)
+ SSL_shutdown(ssl->conn);
+ }
+
+ SSL_free(ssl->conn);
+
+ ERR_clear_error();
+ }
+
+ *ssl = NETDATA_SSL_UNSET_CONNECTION;
}
static inline bool is_handshake_complete(NETDATA_SSL *ssl, const char *op) {
@@ -231,11 +234,12 @@ ssize_t netdata_ssl_read(NETDATA_SSL *ssl, void *buf, size_t num) {
if(unlikely(bytes <= 0)) {
int err = SSL_get_error(ssl->conn, bytes);
- netdata_ssl_log_error_queue("SSL_read", ssl);
if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) {
ssl->ssl_errno = err;
errno = EWOULDBLOCK;
}
+ else
+ netdata_ssl_log_error_queue("SSL_read", ssl, err);
bytes = -1; // according to read() or recv()
}
@@ -267,11 +271,12 @@ ssize_t netdata_ssl_write(NETDATA_SSL *ssl, const void *buf, size_t num) {
if(unlikely(bytes <= 0)) {
int err = SSL_get_error(ssl->conn, bytes);
- netdata_ssl_log_error_queue("SSL_write", ssl);
if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) {
ssl->ssl_errno = err;
errno = EWOULDBLOCK;
}
+ else
+ netdata_ssl_log_error_queue("SSL_write", ssl, err);
bytes = -1; // according to write() or send()
}
@@ -353,7 +358,8 @@ bool netdata_ssl_connect(NETDATA_SSL *ssl) {
}
if (err != 1) {
- netdata_ssl_log_error_queue("SSL_connect", ssl);
+ err = SSL_get_error(ssl->conn, err);
+ netdata_ssl_log_error_queue("SSL_connect", ssl, err);
ssl->state = NETDATA_SSL_STATE_FAILED;
return false;
}
@@ -378,7 +384,8 @@ bool netdata_ssl_accept(NETDATA_SSL *ssl) {
}
if (err != 1) {
- netdata_ssl_log_error_queue("SSL_accept", ssl);
+ err = SSL_get_error(ssl->conn, err);
+ netdata_ssl_log_error_queue("SSL_accept", ssl, err);
ssl->state = NETDATA_SSL_STATE_FAILED;
return false;
}
diff --git a/libnetdata/socket/security.h b/libnetdata/socket/security.h
index c83b60ad1..a4082a077 100644
--- a/libnetdata/socket/security.h
+++ b/libnetdata/socket/security.h
@@ -65,7 +65,6 @@ bool netdata_ssl_accept(NETDATA_SSL *ssl);
bool netdata_ssl_open(NETDATA_SSL *ssl, SSL_CTX *ctx, int fd);
void netdata_ssl_close(NETDATA_SSL *ssl);
-void netdata_ssl_log_error_queue(const char *call, NETDATA_SSL *ssl);
ssize_t netdata_ssl_read(NETDATA_SSL *ssl, void *buf, size_t num);
ssize_t netdata_ssl_write(NETDATA_SSL *ssl, const void *buf, size_t num);
diff --git a/libnetdata/socket/socket.c b/libnetdata/socket/socket.c
index 220db7601..7f0b81fee 100644
--- a/libnetdata/socket/socket.c
+++ b/libnetdata/socket/socket.c
@@ -1052,19 +1052,22 @@ ssize_t recv_timeout(int sockfd, void *buf, size_t len, int flags, int timeout)
return -1;
}
- if(!retval)
+ if(!retval) {
// timeout
return 0;
+ }
if(fd.revents & POLLIN)
break;
}
#ifdef ENABLE_HTTPS
- if (SSL_connection(ssl))
+ if (SSL_connection(ssl)) {
return netdata_ssl_read(ssl, buf, len);
+ }
#endif
+ internal_error(true, "%s(): calling recv()", __FUNCTION__ );
return recv(sockfd, buf, len, flags);
}
diff --git a/netdata.spec.in b/netdata.spec.in
index baf690660..ec7db7b12 100644
--- a/netdata.spec.in
+++ b/netdata.spec.in
@@ -174,13 +174,21 @@ Suggests: netdata-plugin-cups
# Note: Some or all of the Packages may be found in the EPEL repo,
# rather than the standard ones
-# nfacct plugin dependencies
+# epbf plugin dependencies
+%if 0%{?_have_ebpf}
+%if 0%{?suse_version}
+BuildRequires: libelf-devel
+%else
+BuildRequires: elfutils-libelf-devel
+%endif
+%endif
+# end ebpf plugin dependencies
+# nfacct plugin dependencies
%if 0%{?_have_nfacct}
BuildRequires: libmnl-devel
BuildRequires: libnetfilter_acct-devel
%endif
-
# end nfacct plugin dependencies
# freeipmi plugin dependencies
@@ -334,8 +342,13 @@ install -m 750 -p packaging/installer/netdata-uninstaller.sh \
# ###########################################################
# Install netdata service
+
install -m 755 -d "${RPM_BUILD_ROOT}%{_unitdir}"
+%if 0%{?centos_ver} != 7 && 0%{?amazon_linux} != 2
install -m 644 -p system/systemd/netdata.service "${RPM_BUILD_ROOT}%{_unitdir}/netdata.service"
+%else
+install -m 644 -p system/systemd/netdata.service.v235 "${RPM_BUILD_ROOT}%{_unitdir}/netdata.service"
+%endif
install -m 755 -d "${RPM_BUILD_ROOT}%{_presetdir}"
install -m 644 -p system/systemd/50-netdata.preset "${RPM_BUILD_ROOT}%{_presetdir}/50-netdata.preset"
@@ -385,10 +398,11 @@ install_go() {
)
if [ -z "${NETDATA_DISABLE_GO+x}" ]; then
- echo >&2 "Install go.d.plugin"
- ARCH=$(uname -m)
+ ARCH="%{_arch}"
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
+ echo >&2 "Install go.d.plugin (ARCH=${ARCH}, OS=${OS})"
+
for index in "${ARCH_MAP[@]}" ; do
KEY="${index%%::*}"
VALUE="${index##*::}"
@@ -883,6 +897,8 @@ fi
%caps(cap_dac_read_search=ep) %attr(0750,root,netdata) %{_libexecdir}/%{name}/plugins.d/debugfs.plugin
%changelog
+* Wed Jun 14 2023 Konstantin Shalygin <k0ste@k0ste.ru> 0.0.0-20
+- Added eBPF build dependency (again)
* Fri Apr 07 2023 Austin Hemmelgarn <austin@netdata.cloud> 0.0.0-19
- Split additional plugins out in their own packages.
* Tue Mar 21 2023 Austin Hemmelgarn <austin@netdata.cloud> 0.0.0-18
@@ -927,7 +943,7 @@ First draft refactor on package dependencies section
* Wed Jan 02 2019 Pawel Krupa <pkrupa@redhat.com> - 0.0.0-3
- Temporary set version statically
- Fix changelog ordering
-- Comment-out node.d configuration directory
+- Comment-out node.d configuration directory
* Wed Jan 02 2019 Pawel Krupa <pkrupa@redhat.com> - 0.0.0-2
- Fix permissions for log files
* Sun Nov 15 2015 Alon Bar-Lev <alonbl@redhat.com> - 0.0.0-1
diff --git a/packaging/makeself/install-or-update.sh b/packaging/makeself/install-or-update.sh
index 636fb6110..f8b32ed74 100755
--- a/packaging/makeself/install-or-update.sh
+++ b/packaging/makeself/install-or-update.sh
@@ -164,10 +164,21 @@ run chmod g+rx,o+rx /opt
run find /opt/netdata -type d -exec chmod go+rx '{}' \+
run chown -R ${NETDATA_USER}:${NETDATA_GROUP} /opt/netdata/var
+if [ -d /opt/netdata/usr/libexec/netdata/plugins.d/ebpf.d ]; then
+ run chown -R root:${NETDATA_GROUP} /opt/netdata/usr/libexec/netdata/plugins.d/ebpf.d
+fi
+
# -----------------------------------------------------------------------------
progress "changing plugins ownership and permissions"
+for x in apps.plugin perf.plugin slabinfo.plugin debugfs.plugin freeipmi.plugin ioping cgroup-network ebpf.plugin nfacct.plugin xenstat.plugin python.d.plugin charts.d.plugin go.d.plugin ioping.plugin cgroup-network-helper.sh; do
+ f="usr/libexec/netdata/plugins.d/${x}"
+ if [ -f "${f}" ]; then
+ run chown root:${NETDATA_GROUP} "${f}"
+ fi
+done
+
if command -v setcap >/dev/null 2>&1; then
run setcap "cap_dac_read_search,cap_sys_ptrace=ep" "usr/libexec/netdata/plugins.d/apps.plugin"
run setcap "cap_dac_read_search=ep" "usr/libexec/netdata/plugins.d/slabinfo.plugin"
@@ -183,7 +194,6 @@ if command -v setcap >/dev/null 2>&1; then
else
for x in apps.plugin perf.plugin slabinfo.plugin debugfs.plugin; do
f="usr/libexec/netdata/plugins.d/${x}"
- run chown root:${NETDATA_GROUP} "${f}"
run chmod 4750 "${f}"
done
fi
@@ -192,7 +202,6 @@ for x in freeipmi.plugin ioping cgroup-network ebpf.plugin nfacct.plugin xenstat
f="usr/libexec/netdata/plugins.d/${x}"
if [ -f "${f}" ]; then
- run chown root:${NETDATA_GROUP} "${f}"
run chmod 4750 "${f}"
fi
done
diff --git a/packaging/version b/packaging/version
index d71bf1753..9b8e395e5 100644
--- a/packaging/version
+++ b/packaging/version
@@ -1 +1 @@
-v1.40.0
+v1.40.1
diff --git a/streaming/sender.c b/streaming/sender.c
index c74c9b407..6e58d9a21 100644
--- a/streaming/sender.c
+++ b/streaming/sender.c
@@ -554,7 +554,7 @@ static bool rrdpush_sender_connect_ssl(struct sender_state *s) {
return true;
}
- // failed to establish connection
+ error("SSL: failed to establish connection.");
return false;
#else
@@ -708,7 +708,7 @@ static bool rrdpush_sender_thread_connect_to_parent(RRDHOST *host, int default_p
if(!rrdpush_sender_connect_ssl(s))
return false;
- ssize_t bytes;
+ ssize_t bytes, len = strlen(http);
bytes = send_timeout(
#ifdef ENABLE_HTTPS
@@ -716,7 +716,7 @@ static bool rrdpush_sender_thread_connect_to_parent(RRDHOST *host, int default_p
#endif
s->rrdpush_sender_socket,
http,
- strlen(http),
+ len,
0,
timeout);
@@ -730,8 +730,6 @@ static bool rrdpush_sender_thread_connect_to_parent(RRDHOST *host, int default_p
return false;
}
- // info("STREAM %s [send to %s]: waiting response from remote netdata...", rrdhost_hostname(host), s->connected_to);
-
bytes = recv_timeout(
#ifdef ENABLE_HTTPS
&host->sender->ssl,
diff --git a/web/server/web_client.c b/web/server/web_client.c
index 6e3c1225e..5dcff0b0f 100644
--- a/web/server/web_client.c
+++ b/web/server/web_client.c
@@ -1933,6 +1933,8 @@ ssize_t web_client_receive(struct web_client *w)
// do we have any space for more data?
buffer_need_bytes(w->response.data, NETDATA_WEB_REQUEST_INITIAL_SIZE);
+ errno = 0;
+
#ifdef ENABLE_HTTPS
if ( (!web_client_check_unix(w)) && (netdata_ssl_web_server_ctx) ) {
if (SSL_connection(&w->ssl)) {
@@ -1962,6 +1964,10 @@ ssize_t web_client_receive(struct web_client *w)
debug(D_WEB_CLIENT, "%llu: Received %zd bytes.", w->id, bytes);
debug(D_WEB_DATA, "%llu: Received data: '%s'.", w->id, &w->response.data->buffer[old]);
}
+ else if(unlikely(bytes < 0 && (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR))) {
+ web_client_enable_wait_receive(w);
+ return 0;
+ }
else if (bytes < 0) {
debug(D_WEB_CLIENT, "%llu: receive data failed.", w->id);
WEB_CLIENT_IS_DEAD(w);