-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Ensure vttablet does not crash if not given all parameters it expects #3195
Conversation
Specifically I managed to crash it when mycnf was empty and it tried to reference the socket name to talk to mysqld on. Even if that setting is not present the binary should not fail and given it's possible via the appropraite dbconfig-XXXX settings to configure access to a remote mysqld then the requirement for the socket should not be there. If you see a better fix then feel free to implement this.
Example (simplified) usage where this happened:
Would trigger the breakage. |
This "fix" only causes problems later on in Basically vttablet which shouldn't need much in the way of "mysqld information" seems to pull off several settings from a What's somewhat troublesome is if you're trying to not use vttablet to manage the underlying mysqld is to know exactly which settings are expected as the error messages do not tell you this. So perhaps this specific PR should actually give an error message: Maybe too line 91 of mysqld.go above could catch the missing settings and give a good message too? I can change this PR to something better but am not sure what you think is acceptable or best, but from my point of view clarifying the required configs needed to reach vttablet (managed or not) would be useful as then we'd have a clearer target to improve our configuration and launch scripts. So feedback on what you think about this and the best way if I bump into things like this again to handle them would be most welcome. |
On second thoughts maybe for now it's better to not try to fix each problem but to catch and report the situation and let the user deal with this? Longer term simplification of command line parameters may be better but avoiding a crash and indicating which expected variable is nil at least points at the technical cause even if it does lead the user to have to investigate further in the code. |
This bug has confused many people because it just crashes vttablet with a mysterious SIGSEGV. The problem was a bug in the error propagation of mycnf which was using old panic style error handling. This also addresses what vitessio#3195 was trying to fix.
Fixed via #3568 |
Specifically I managed to crash it when mycnf was empty and it tried to reference the socket name to talk to mysqld on. Even if that setting is not present the binary should not fail and given it's possible via the appropraite
dbconfig-XXXX
settings to configure access to a remote mysqld then the requirement for the socket should not be there.If you see a better fix then feel free to implement this.