Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.4.0-rc.2: Follow-up error on start-up: lokiWriter failed to forward entry, channel was blocked #6542

Closed
jkroepke opened this issue Feb 28, 2024 · 4 comments · Fixed by #6558
Assignees
Labels
bug Something isn't working frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.

Comments

@jkroepke
Copy link
Contributor

jkroepke commented Feb 28, 2024

What's wrong?

I'm using import.http (new syntax in 0.40) together with logging and loki.write.

logging, import.http and loki.write are on the same local configuration.

If there is an error in a imported component, I getting an error from the logging block, too. This may confused people.

Steps to reproduce

  1. setup config with import.file , logging and loki.write
  2. have a syntax error or something else inside the imported module cause an could not perform the initial load successfully error

System information

Linux

Software version

Grafana Agent v0.40.0-rc.2

Configuration

Let me know, if I should provide one.

Logs

{"ts":"2024-02-28T09:36:39.878497528Z","level":"error","msg":"failed to evaluate config","controller_id":"all.config.this","trace_id":"7fe423b9ede149b939a284690834b4b3","node":"prometheus.remote_write.prometheus","err":"decoding River: all:107:17: unrecognized attribute name \"remote_username\""}
{"ts":"2024-02-28T09:36:39.878560328Z","level":"error","msg":"failed to evaluate config","controller_id":"","trace_id":"2b75bd4dd148b8c86d06d4c36fcadd83","node":"logging","err":"could not update logger: lokiWriter failed to forward entry, channel was blocked"}
Error: all:107:17: unrecognized attribute name "remote_username"

Error: /config/azure-server.river:48:1: Failed to evaluate node for config block: could not update logger: lokiWriter failed to forward entry, channel was blocked

47 |   
48 |   logging {
   |  _^^^^^^^^^
49 | |     level  = "warn"
50 | |     format = "json"
51 | |     write_to = [loki.write.remote.receiver]
52 | | }
   | |_^
53 |   loki.write "remote" {
interrupt received

Error: could not perform the initial load successfully
@jkroepke jkroepke added the bug Something isn't working label Feb 28, 2024
@JustNZ
Copy link

JustNZ commented Feb 28, 2024

+1

@jkroepke jkroepke changed the title 0.4.0-rc.0: Follow-up error on start-up: lokiWriter failed to forward entry, channel was blocked 0.4.0-rc.2: Follow-up error on start-up: lokiWriter failed to forward entry, channel was blocked Feb 28, 2024
@wildum wildum self-assigned this Feb 29, 2024
@wildum
Copy link
Contributor

wildum commented Feb 29, 2024

I don't think this has something to do with modules, when I just run:

logging {
	write_to = [loki.write.remote.receiver]
}

loki.write "remote" {
    endpoint {
        url = "http://loki:3100/loki/api/v1/push"
    }
}

I'm getting the error "Error: ../config.river:1:1: Failed to evaluate node for config block: could not update logger: lokiWriter failed to forward entry, channel was blocked" and "Error: could not perform the initial load successfully"

We don't return directly on error, we continue evaluating so if you also have a broken module you will get the error for the module too.

@wildum
Copy link
Contributor

wildum commented Feb 29, 2024

now there seems to be a real bug with the logging config block introduced by #5992

@wildum
Copy link
Contributor

wildum commented Feb 29, 2024

I believe that I identified the problem: with #5992 we buffer the logs in the logger till it gets updated with the correct format. During the initial eval, it will already start buffering some lines of logs. When it gets updated, it will set the correct format/level and will empty its buffer. In this scenario, it needs to write the logs in the receiver of loki.write. For this we use an unbuffered channel. The problem is that loki.write is not ready to receive it because it's not running yet (we are still at the initial eval). => The logger fails to empty the buffered logs in the receiver channel, ending up with the error "lokiWriter failed to forward entry, channel was blocked"

@wildum wildum mentioned this issue Feb 29, 2024
1 task
@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Mar 31, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants