Infinite loop while watching for Kubernetes events
Both when using add_kubernetes_metadata or kubernetes autodiscover provider, some users have reported this issue (which causes an infinite loop):
2018-03-05T08:16:36.021Z ERROR kubernetes/watcher.go:188 kubernetes: Watching API error EOF
2018-03-05T08:16:36.021Z INFO kubernetes/watcher.go:173 kubernetes: Watching API for resource events
2018-03-05T08:16:36.030Z ERROR kubernetes/watcher.go:188 kubernetes: Watching API error proto: wrong wireType = 6 for field ServiceAccountName
2018-03-05T08:16:36.030Z INFO kubernetes/watcher.go:173 kubernetes: Watching API for resource events
2018-03-05T08:16:36.031Z ERROR kubernetes/watcher.go:188 kubernetes: Watching API error proto: wrong wireType = 6 for field ServiceAccountName
2018-03-05T08:16:36.031Z INFO kubernetes/watcher.go:173 kubernetes: Watching API for resource events
2018-03-05T08:16:36.033Z ERROR kubernetes/watcher.go:188 kubernetes: Watching API error proto: wrong wireType = 6 for field ServiceAccountName
More details can be found here: https://github.com/elastic/beats/pull/6353
I've pushed a branch ignoring unmarshall errors: https://github.com/exekias/beats/tree/ignore-k8s-errors
Also built an image from it: exekias/filebeat:ignore-k8s-errors, @simioa it would be awesome if you could do another test, your help here is much appreciated
@exekias Looks good, no problems till now.
Good to hear, @simioa, I'm wondering, did you see the ERROR happen?
The code doesn't really avoid that message but should recover from it in all cases:
kubernetes: Watching API error proto: wrong wireType = 6 for field ServiceAccountName
Not that ERROR Message but this:
2018-03-08T15:33:50.114Z ERROR kubernetes/watcher.go:198 kubernetes: Watching API error EOF
I just looked into an Filebeat 6.2.2 Log and saw that right after the kubernetes: Watching API error EOF ERROR appeared, the infinite loop started.
This is not the case anymore, the only thing logged after the EOF Error related to the Watching API is:
2018-03-08T15:33:50.114Z INFO kubernetes/watcher.go:181 kubernetes: Watching API for resource events
Ok, please keep an eye on it and report if it happens :innocent:
In the meanwhile, it seems we now have a way to reproduce it, I will be doing some testing myself
Thank you for your effort! It's really helping with this issue
A fix has been merged and should go out in both 6.3.0 and 6.2.3
what's the ETA for new container 6.2.3 with the fix merged ?
It should be out soon, in any case, for convenience, I've pushed a snapshot build with the fix: exekias/filebeat:6.2.3-snapshot
An update on this, new images for 6.2.3 are already available: https://www.docker.elastic.co/
@exekias this error also appears in 6.4.0, kubernetes 1.6.4 , any workaround for this?
2018-08-19T01:53:44.655Z ERROR kubernetes/watcher.go:254 kubernetes: Watching API error EOF
2018-08-19T01:53:44.655Z INFO kubernetes/watcher.go:238 kubernetes: Watching API for resource events
2018-08-19T01:53:53.051Z ERROR kubernetes/watcher.go:254 kubernetes: Watching API error EOF
2018-08-19T01:53:53.051Z INFO kubernetes/watcher.go:238 kubernetes: Watching API for resource events
2018-08-19T01:53:53.293Z ERROR kubernetes/watcher.go:254 kubernetes: Watching API error EOF
2018-08-19T01:53:53.294Z INFO kubernetes/watcher.go:238 kubernetes: Watching API for resource events
2018-08-19T01:53:54.065Z ERROR kubernetes/watcher.go:254 kubernetes: Watching API error EOF
2018-08-19T01:53:54.065Z INFO kubernetes/watcher.go:238 kubernetes: Watching API for resource events
2018-08-19T01:54:05.405Z ERROR kubernetes/watcher.go:254 kubernetes: Watching API error EOF
2018-08-19T01:54:05.405Z INFO kubernetes/watcher.go:238 kubernetes: Watching API for resource events
2018-08-19T01:54:07.414Z ERROR kubernetes/watcher.go:254 kubernetes: Watching API error EOF
2018-08-19T01:54:07.414Z INFO kubernetes/watcher.go:238 kubernetes: Watching API for resource events
Still appears in 6.3.2:
2018-08-25T14:50:05.364Z INFO [beat] instance/beat.go:725 Build info {"system_info": {"build": {"commit": "45a9a9e1561b6c540e94211ebe03d18abcacae55", "libbeat": "6.3.2", "time": "2018-07-20T04:18:19.000Z", "version": "6.3.2"}}}
...
2018-08-25T18:40:57.180Z ERROR kubernetes/watcher.go:195 kubernetes: Watching API error EOF
2018-08-25T18:40:57.180Z INFO kubernetes/watcher.go:179 kubernetes: Watching API for resource events
@hobti01 Do you have memory issue with filebeat process? With the error appear more and more frequently, the memory useage may grow to 5GB and more.In my cluster, this error appears after filebeat restart about 1 hour.
I found the root cause maybe this line, w.r return empty string, which is abnormal.
https://github.com/elastic/beats/blob/0b32c2d7604145eabb7b5652dc8de7bcccf64baf/vendor/github.com/ericchiang/k8s/watch.go#L100
@yu-yang2 we do not have memory issues. We have noticed that sometimes log shipping will stop for an application container when we update filebeat and is not restarted.
This is the only ERROR in our logs, but this seems to be just a warning about the Kubernetes watch which is automatically restarted.
Same here filebeat version 6.3.2
2018-09-05T04:47:25.540Z ERROR kubernetes/watcher.go:195 kubernetes: Watching API error EOF
2018-09-05T04:47:25.541Z INFO kubernetes/watcher.go:179 kubernetes: Watching API for resource events```
Same error in filebeat v6.4.2 Installed from https://github.com/helm/charts/tree/master/stable/filebeat
2018-11-09T15:03:07.979+0600 ERROR kubernetes/watcher.go:254 kubernetes: Watching API error EOF
I also got this error in v6.4.3. The pod with this error stops collecting kubernetes' metadata. When I restart the pod, the metadata collection resumes, but appears again after a few hours.
2018-11-13T12:23:44.563Z ERROR kubernetes/watcher.go:254 kubernetes: Watching API error EOF
2018-11-13T12:23:44.563Z INFO kubernetes/watcher.go:238 kubernetes: Watching API for resource events
I also have the same errors with v6.4.3 my filebeat memory usage grows until it's killed by kubernetes at about 1gb of usage per pod.
same error for v6.4.3: 2018-11-13T21:11:43.472+0800 ERROR kubernetes/watcher.go:254 kubernetes: Watching API error EOF 2018-11-13T21:11:43.472+0800 INFO kubernetes/watcher.go:238 kubernetes: Watching API for resource events 2018-11-13T21:11:43.474+0800 ERROR kubernetes/watcher.go:254 kubernetes: Watching API error proto: illegal wireType 6 2018-11-13T21:11:43.474+0800 INFO kubernetes/watcher.go:258 kubernetes: Ignoring event, moving to most recent resource version 2018-11-13T21:11:43.474+0800 INFO kubernetes/watcher.go:238 kubernetes: Watching API for resource events
Can we have this re-opened since the issues seems to still be occurring?
@opsnull Do you also see filebeat consuming large amounts of memory?