agent: error: skipping update of position for a file which does not currently exist

What’s wrong?

I have agent+loki+grafana setup, and the agent is configured to tail the log files of my apps and then push them to loki. If you start all of this, after some time this message starts appearing in the agent logs (every 10 sec or smth):

ts=2023-05-15T14:07:33.321533823Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1

Eventually, you’ll get more and more errors like this at once, so it becomes almost impossible to check the agent logs.

I found some issues that seem to be related: https://github.com/grafana/loki/issues/3108 https://github.com/grafana/loki/issues/3985

My services indeed roll their log files after reaching the max file size, although I don’t see any problems with “losing” logs or smth like that (loki stores everything in its storage). I’m also not sure about performance problems, maybe I’ll face them later.

Is it critical? I see that there was this PR, maybe it needs to be merged here as well?

Steps to reproduce

  1. Use any app that has log retention (e.g. java app with Spring Boot + logback config)
  2. deploy agent+loki
  3. check the agent logs after some time (when logs are rolled)

I’m not 100% sure that having log retention is necessary to reproduce it though.

System information

No response

Software version

0.31.3

Configuration

No response

Logs

ts=2023-05-15T14:07:33.297587958Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.309127591Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.309148734Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.309322049Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.309168115Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.31414347Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314134356Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314196232Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.31421379Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314342427Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314356711Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314508679Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.31452438Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314451658Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314467108Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314539858Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314563993Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314608935Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314641607Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.314369259Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.316897402Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.31710958Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.318238841Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.319364763Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1
ts=2023-05-15T14:07:33.321533823Z caller=tailer.go:202 level=info component=logs logs_config=default component=tailer msg="skipping update of position for a file which does not currently exist" path=/tmp/logs/my-service/my-service-1

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 19 (13 by maintainers)

Commits related to this issue

Most upvoted comments

This is caused by a goroutine leak, which can result in excessive, unnecessary logging (as you have noticed), growing memory usage of the agent over time (though it shouldn’t be too fast) and some additional context switching. I’d say this is safe to ignore until the symptoms get too bad, at which point a restart is a good remedy.

Apologies for the hassle caused by this and thanks for reporting the problem!

Thanks @amseager for sharing all the info. I found a goroutine leak and it is likely related to stale NFS file handle error you saw. Still need to figure out exactly where the fix is needed, but we’re getting closer.

While at it, I’ll be making sure we port https://github.com/grafana/tail/pull/16 too.

Same issue here on grafana/agent:v0.39.1.