Commit Graph
45 Commits
Author SHA1 Message Date
Ciprian Hacman a20306e6a1 fix(logwatchers/kmsg): don't close the old parser twice when Stop() interrupts a restart
The restart path closes the failed parser before retrying. If stopping
is signaled during the retry wait, watchLoop's deferred cleanup closed
the same parser again, logging a spurious 'file already closed' error
at shutdown. Clear the reference after closing and nil-check the defer.
2026-07-11 10:28:27 +03:00
Ciprian Hacman b77c1eb03f fix(logwatchers/kmsg): don't block Stop() when the log channel is full
The log monitor stops draining logCh before calling watcher.Stop(), so
with a full channel (e.g. a kmsg burst at shutdown) watchLoop blocked
on the send forever, never called tomb.Done(), and Stop() hung.
Select on tomb.Stopping() alongside the send.
2026-07-11 10:27:59 +03:00
Ciprian Hacman 187d4d30d6 fix(logwatchers/kmsg): rate-limit parser restarts to prevent hot loop
If the restarted parser's channel closes again right away (reads keep
failing on the reopened /dev/kmsg), the watcher restarts in a tight
loop with no delay, spinning a CPU core and flooding the logs
(measured 37k restarts in 200ms). Delay the first attempt when the
previous restart was less than retryDelay ago.
2026-07-11 10:27:37 +03:00
Ciprian Hacman 3d516d9213 test(logwatchers/kmsg): inject parser factory for testability and cover restart/stop 2026-04-11 08:37:32 +03:00
Kubernetes Prow RobotandGitHub ea22add87e Merge pull request #1259 from hakman/kmsg-duplicate-message
fix(logwatchers/kmsg): prevent duplicate message replay after restart
2026-04-11 00:18:18 +05:30
Ciprian Hacman b3379b0d23 fix(logwatchers/kmsg): prevent duplicate message replay after restart 2026-04-10 16:06:32 +03:00
Ciprian Hacman 78f76b2778 fix(logwatchers/kmsg): don't close parser from Stop()
Closing the parser in Stop() triggers kmsgparser's read goroutine to
close its output channel, which made watchLoop take the restart path
(added in #1192) during intentional shutdown. Leave parser cleanup to
watchLoop's defer, which is the single owner of the parser lifecycle.
2026-04-10 15:45:22 +03:00
Arjun Raman 748fecd95d Remove opt-in knob for restarting kmsg parser and simplify retry loop 2026-03-24 11:20:14 -07:00
Arjun RamanandGitHub c530d1f701 Remove log message for restart on error
Removed log message for disabled restart on error.
2025-12-18 12:29:26 -08:00
Arjun Raman f1bdf8d30e Restart kmsg on error 2025-12-11 15:51:24 -08:00
Ciprian Hacman 2e69489cc6 Update golangci-lint to v2.6.2 2025-11-29 10:42:18 +02:00
Sergey Kanzhelev 3e64800668 enabled a few more linter rules 2025-09-11 18:47:20 +00:00
Sergey Kanzhelev 0ce333bbc5 enabled and fixed the errcheck linter rule 2025-09-10 21:45:46 +00:00
Sergey Kanzhelev 75bf501888 format imports 2025-08-13 16:56:32 +00:00
tashen 3a386a659e add skip list to aviod take too much efforts to translate in file log watcher 2024-10-16 10:56:15 +08:00
Ciprian Hacman fdd522a951 Update github.com/coreos/go-systemd to v22.5.0 2023-09-20 07:13:42 +03:00
Ciprian Hacman 65e4aa3c5e Remove dependency on code.cloudfoundry.org/clock 2023-09-19 12:50:29 +03:00
Ciprian Hacman 5210373640 Init useful flags for klog/v2 2023-09-17 11:00:42 +03:00
Manuel RügerandCiprian Hacman e43459d86d Move glog/klog logging to klog/v2 2023-09-17 08:57:33 +03:00
Ciprian Hacman f58f6cd208 Update tests to run also on macOS 2023-09-11 19:25:59 +03:00
Ciprian Hacman 2077606ba3 Remove direct dependency on google/cadvisor 2023-09-08 15:28:25 +03:00
Fan Shang Xiang adbe770d74 replace k8s.io/apimachinery/pkg/util/clock with k8s.io/utils/clock 2023-08-31 06:27:32 +00:00
Kubernetes Prow RobotandGitHub e6fbdd434a Merge pull request #760 from MartinForReal/master
bump k8s.io dependencies to 1.17.2
2023-06-25 21:41:16 -07:00
guoguangwu 6dc23ca804 chore: remove refs to deprecated io/ioutil 2023-06-21 12:12:27 +08:00
Fan Shang Xiang b5e4ef628b bump k8s.io to 1.17.2 2023-06-12 22:27:39 +08:00
Kubernetes Prow RobotandGitHub 7b6805491c Merge pull request #716 from zendesk/grosser/silence
remove "Start watching journald" to avoid plugin log spam
2023-01-31 23:13:06 -08:00
Michael Grosser a83ef25930 remove "Start watching journald" to avoid plugin log spam 2023-01-31 21:31:31 -08:00
Yordis Prieto Lazo 0842910049 chore: fix misspelling 2022-12-18 22:58:07 -05:00
Jeremy Edwards adc587f222 Support filelog watching in Windows. 2021-01-13 17:16:46 +00:00
Jeremy Edwards 4adec4bbc6 Introduce Windows build of Node Problem Detector 2020-12-05 23:54:52 +00:00
yuzhiquan b458f0d028 fix: modify typo 2019-12-03 15:21:57 +08:00
Lantao Liu be7cc78aa0 Properly close channel when monitor exits.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-10-25 14:11:39 -07:00
Andrew Stribblehill 09c498ad74 Empty LogPath will use journald's default path. 2019-08-27 01:55:30 +02:00
Xuewei Zhang c6c4e80c9d Remove TestGoroutineLeak unit tests.
We are seeing some flakes on these tests because some goroutine
fluctuation:
https://github.com/kubernetes/node-problem-detector/pull/275#issuecomment-499306727

Removing the tests, as it's robust to test leakage in a soak/stress
test, rather than unit test.
2019-06-06 16:27:59 -07:00
Zhen Wang 1f636381b8 Detect kubelet and container runtime frequent crashes 2018-11-26 22:41:06 -08:00
AdamDangandGitHub e6e42175fa Typo fix: encounts->encounters
encounts->encounters
2018-06-22 14:04:45 +08:00
Andy Xie 10dbfef1a8 add custom problem detector plugin 2017-11-22 10:14:09 +08:00
Random-Liu 51351f91b2 Cleanup kmsg log wather. 2017-05-30 15:58:45 -07:00
Lantao LiuandGitHub be6c516cfd Merge pull request #41 from euank/kmsg-parser
logwatchers: add new kmsg-based kernel log watcher
2017-05-30 15:53:24 -07:00
Euan Kemp 9c23921c11 logwatchers/kmsg: add initial kmsg watcher impl
This adds a logwatcher which is able to parse kernel messages directly
from the /dev/kmsg interface. This supports any modern linux distro,
while also avoiding any dependency on libraries (e.g. as journald
needs).
2017-03-09 20:40:49 -08:00
Random-Liu 02d6b89536 Fix journald plugin to only look at the current boot. 2017-03-02 13:57:38 -08:00
fate-grand-orderandGitHub a756ef48f3 fix misspell "timestamp" 2017-02-21 23:01:30 +08:00
Random-Liu 889d9efbc1 Add unit test for goroutine leak. 2017-02-16 00:08:56 -08:00
Random-Liu 6170b0c87f Add multiple log monitoring support. 2017-02-15 13:15:18 -08:00
Random-Liu 10fc831409 Change kernel specific name in code base and change syslog to filelog. 2017-02-15 13:07:01 -08:00