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: k8s Status GenServer noproc #564

Merged
merged 5 commits into from
Jun 14, 2024
Merged

fix: k8s Status GenServer noproc #564

merged 5 commits into from
Jun 14, 2024

Conversation

jonas-martinez
Copy link
Collaborator

@jonas-martinez jonas-martinez commented Apr 4, 2024

About this PR

Closes #562

Technical highlight/advice

There was an issue with the Kubernetes.Status GenServer that could not be stopped because it did not exist.
The stop method is called directly from Kubernetes with the CALLBACK_URL that is passed as a secret.

So Kubernetes calls the runner/build/:id API endpoint to update the build status. The server updates the status which is good and expected behaviour, it then tries to stop the Kubernetes.Status GenServer because it is not needed anymore. I don't really know why but this GenServer does not exist when the error occurs and it crashes the server.

We just want to ignore the error when the GenServer does not exist because it means that we do not need to stop it as it is already stopped.

How to test my changes

I don't know how you can test my changes easily because you need to setup a kubernetes cluster on your computer.

Checklist

  • I didn't over-scope my PR
  • My PR title matches the commit convention
  • I did not include breaking changes
  • I made my own code-review before requesting one

I included unit tests that cover my changes

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

I added/updated the documentation about my changes

  • 📜 README.md
  • 📕 docs/*.md
  • 📓 docs.lenra.io
  • 🙅 no documentation needed

@taorepoara
Copy link
Member

Just ignoring an error is never a good solution. If this problem only appear when the server restart, it's indeed not a big problem (since it only stops the GenServer, but we should check if the GenServer does something when it's stopped), you should at least add a log message with the warning level.

@jonas-martinez
Copy link
Collaborator Author

jonas-martinez commented Apr 12, 2024

EDIT: Please ignore what I wrote below, I mixed up this PR with the other PR on the oauth token 😆

Well it is not really an error, if the user modifies his token for whatever reason should we consider this an error on Lenra ?

I don't think that a corrupted token should be treated as an error, we should just ask the user to log in again.

Note that this error occurs when a new oauth client is created and used and the user tries to connect with his oauth token from the old oauth client.

I will add a Logger.warning just in case, it will happen very rarely anyway so this will not spam the console.

@jonas-martinez
Copy link
Collaborator Author

@taorepoara I added the warning log as you asked.

@jonas-martinez jonas-martinez merged commit 1ee023d into main Jun 14, 2024
4 checks passed
@jonas-martinez jonas-martinez deleted the fix-k8s-status-stop branch June 14, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Kubernetes build status fetch error on server restart
2 participants