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

No error logs when the HTTP server cannot start #694

Closed
rfratto opened this issue Apr 26, 2024 · 1 comment · Fixed by #841 · May be fixed by #700
Closed

No error logs when the HTTP server cannot start #694

rfratto opened this issue Apr 26, 2024 · 1 comment · Fixed by #841 · May be fixed by #700
Assignees
Labels
bug Something isn't working frozen-due-to-age good first issue Good for newcomers

Comments

@rfratto
Copy link
Member

rfratto commented Apr 26, 2024

What's wrong?

If the HTTP server cannot start (such as the listen address is already in-use by another process), the HTTP server fails silently and doesn't generate any error-level logs.

This is related to #364, but slightly more specific, as the user has no signal that anything went wrong, other than self-scraping and scraping exporter components fail.

Note that the HTTP service does return an error, but this error isn't logged anywhere.

A reasonable fix here would be to change the code for the runnable scheduler to not ignore errors, or at least explicitly log errors before returning the error in the HTTP service.

Steps to reproduce

  1. Run two Alloy instances running listening on the same listen address.
  2. Observe that the Alloy instance which started second does not have any log lines for now listening for http traffic nor any error indicating failed to listen.

System information

No response

Software version

v1.0.0

Configuration

N/A

Logs

N/A (it's the lack of logs which is the problem 😛)

@rfratto rfratto added the bug Something isn't working label Apr 26, 2024
@rfratto rfratto added the good first issue Good for newcomers label Apr 26, 2024
@mrashad10
Copy link

I've begun working on this and aim to deliver the code today.

mrashad10 pushed a commit to mrashad10/alloy that referenced this issue Apr 28, 2024
This commit modifies the goroutine that starts the HTTP server to explicitly log any errors encountered during startup, except for `http.ErrServerClosed`, which is expected during graceful shutdown. This change ensures that issues related to the server's startup, such as the address already being in use, are logged, making it easier to diagnose and fix.

Closes grafana#694
@mattdurham mattdurham self-assigned this May 14, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 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 good first issue Good for newcomers
Projects
None yet
3 participants