-
Notifications
You must be signed in to change notification settings - Fork 542
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
program panic when failed to initialize etcd store is unreasonable #1684
Comments
that also happens when ectd is unable to connect |
Yep, let it crash is not a good way here. |
thanks for feedback |
Hii!! everyone, can I work on this issue? So what should be the ideal behaviour for manager-api if such a case happens? |
@bisakhmondal Sure, assigned to you. |
hi @bisakhmondal Output some messages to hint at this failure and exit. |
@bisakhmondal We don't have to panic the program, instead, we may report the error reason and exit with a non-zero code. |
Okay, we can definitely go with it. I would like to mention an issue in this approach. We are keeping a slice of closers [ ref ] for all the allocated resources (including etcd connection), so in case of any error, for a graceful shutdown, the already allocated resource's closer method should be called. os.Exit(1) will immediately abort the program. But that is not the case for panic. Even after panic the early evaluated defers will get executed in LIFO order. So I have put IMHO, panic is fine here. Let me know what you think. Thanks :) |
Yes, I agree that all finalizers or closers should be run even if exceptions occur, the reason why I think the spontaneous |
Very true. Pushing the new changes then :) |
Issue description
Say my etcd cluster contains some corrupted data, which causes the manager api launching failed, the manager-api just crashes and the output is not so friendly.
Expected behavior
Output some messages to hint at this failure and exit.
Screenshots
Environment
apisix version
):uname -a
):nginx -V
oropenresty -V
):curl http://127.0.0.1:9090/v1/server_info
to get the info from server-info API): 3.5.0-alpha0Additional context
The text was updated successfully, but these errors were encountered: