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

Elasticsearch controller: fix panic and dropped error result during node shutdown #7875

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

pebrc
Copy link
Collaborator

@pebrc pebrc commented Jun 7, 2024

We were ignoring an error during a node shutdown initialisation and panicking on a subsequently uninitialised map.

Technically it should be enough to handle the error but I chose to also intialise the map by default.

For future reference, this was discovered through an e2e test (props to @thbkrkr for the throrough analysis).

[
	expected less than 1, got 2, restarts: [
		{o44cyWaAQQuzmvh3g_iOzQ RESTART 187844 1717724317347 COMPLETE {COMPLETE 0 no shard relocation is necessary for a node restart} {COMPLETE} {COMPLETE}} 
		{LSN_PaSuRoOIsQF3QKyx3g RESTART 187995 1717724469546 COMPLETE {COMPLETE 0 no shard relocation is necessary for a node restart} {COMPLETE} {COMPLETE}}
]

We discovered that a previous shutdown record was still present. This should not happen as we clear shutdown records before proceeding to the next node. We then found that the operator had been restarted twice once in the middle to the upgrade process. Which lead to the discovery of the following panic:

Capture d’écran 2024-06-07 à 11 34 46

If a shutdown request was made and the local state about the number of shutdown requests was not intialised correctly another shutdown request can be made. Updating the state with the outcome of the request could then lead to the observed panic.

We are lackign a bit of test coverage in this area, so I am probably going to push a unit test once I find a the right scope. I don't have the capacity right now to improve the coverage. We relied on e2e test coverage for this part of the code in the past and one could say that the e2e test found the bug eventually.

We should however alert on panics in the e2e cluster.

@pebrc pebrc added the >bug Something isn't working label Jun 7, 2024
Copy link
Contributor

@thbkrkr thbkrkr left a comment

Choose a reason for hiding this comment

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

LGTM

@thbkrkr
Copy link
Contributor

thbkrkr commented Jun 7, 2024

buildkite test this -f p=gke,s=7.17.8,t=TestMutationAndReversal

@pebrc pebrc merged commit 33546a3 into elastic:main Jun 7, 2024
5 checks passed
@barkbay barkbay changed the title Fix panic and dropped error result Elasticsearch controller: fix panic and dropped error result during node shutdown Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug Something isn't working v2.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants