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

fix(elasticsearch): Zebra panics with all features and no elasticsearch server available #8409

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

oxarbitrage
Copy link
Contributor

@oxarbitrage oxarbitrage commented Apr 17, 2024

Motivation

When Zebra is compiled with all features or the elasticsearch feature it will panics when it starts if no elasticsearch server is available in the default endpoint. We want to avoid the panic and continue running even if with errors.

Close #8329

Solution

Before inserting send a ping to the elasticsearch server to check if it is available, log an error to the user if not and continue running. In the next batch error will be logged again so the user running zebrad with elasticsearch feature enabled will always know that there is something wrong even if the rest of the functionality remains running. This can be annoying but i think is ok here.

2024-04-17T16:16:21.390620Z ERROR zebra_state::service::finalized_state: Elasticsearch is not available, skipping block indexing
2024-04-17T16:16:22.280629Z ERROR zebra_state::service::finalized_state: Elasticsearch is not available, skipping block indexing
2024-04-17T16:16:23.705238Z ERROR zebra_state::service::finalized_state: Elasticsearch is not available, skipping block indexing
2024-04-17T16:16:25.530342Z ERROR zebra_state::service::finalized_state: Elasticsearch is not available, skipping block indexing
2024-04-17T16:16:27.024986Z ERROR zebra_state::service::finalized_state: Elasticsearch is not available, skipping block indexing
2024-04-17T16:16:28.002725Z ERROR zebra_state::service::finalized_state: Elasticsearch is not available, skipping block indexing
2024-04-17T16:16:28.801490Z ERROR zebra_state::service::finalized_state: Elasticsearch is not available, skipping block indexing
2024-04-17T16:16:29.615119Z ERROR zebra_state::service::finalized_state: Elasticsearch is not available, skipping block indexing
2024-04-17T16:16:30.602919Z ERROR zebra_state::service::finalized_state: Elasticsearch is not available, skipping block indexing

Testing

Manually tested with elasticsearch server running and without it.

Review

Anyone can review.

Reviewer Checklist

Check before approving the PR:

  • Does the PR scope match the ticket?
  • Are there enough tests to make sure it works? Do the tests cover the PR motivation?
  • Are all the PR blockers dealt with?
    PR blockers can be dealt with in new tickets or PRs.

And check the PR Author checklist is complete.

Follow Up Work

@oxarbitrage oxarbitrage added I-panic Zebra panics with an internal error message P-Low ❄️ labels Apr 17, 2024
@oxarbitrage oxarbitrage requested a review from a team as a code owner April 17, 2024 16:34
@oxarbitrage oxarbitrage requested review from arya2 and removed request for a team April 17, 2024 16:34
@github-actions github-actions bot added C-feature Category: New features labels Apr 17, 2024
Copy link
Contributor

@arya2 arya2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@mergify mergify bot merged commit 2995ea0 into main Apr 17, 2024
135 checks passed
@mergify mergify bot deleted the issue8329 branch April 17, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: New features I-panic Zebra panics with an internal error message P-Low ❄️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enabling the elasticsearch feature makes Zebra panic
2 participants