-
Notifications
You must be signed in to change notification settings - Fork 5
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
[GAIAPLAT-1236] db_server - better error message when 'Address already in use' #881
[GAIAPLAT-1236] db_server - better error message when 'Address already in use' #881
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, except that I think we need to print the friendly error message first.
// TODO it would be nice to have a common error handler that can handle common errors. | ||
if (errno == EADDRINUSE) | ||
{ | ||
cerr << "ERROR: bind() failed! - " << (::strerror(errno)) << endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the pattern should be that we print the friendly error message before the detailed message/stack trace. (You could also avoid duplicating the system error message by putting this in a try/catch block and printing e.what()
, but maybe it's simpler this way for now.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the same pattern and formatting used in gaiac
. At the moment I'm trying to make things consistent. Once we re-design the CLI we can re-evaluate these decisions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
➜ cmake-build-gaiarelease-debug git:(wayne/test-auto-conn-discon) ✗ catalog/gaiac/gaiac ../schemas/test/one_to_one/one_to_one.ddl
ERROR: Connect failed! - Connection refused
Can't connect to a running instance of the Gaia Database Server.
Start the Gaia Database Server and rerun gaiac.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, that's not so bad (as long as there's no stack trace before the friendly message). Approved.
// TODO it would be nice to have a common error handler that can handle common errors. | ||
if (errno == EADDRINUSE) | ||
{ | ||
cerr << "ERROR: bind() failed! - " << (::strerror(errno)) << endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for our use? If not what useful information does it provide to the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, more skilled users will know what the syscall bind
is. For now, we just have this one but in the future, we may have more, and knowing exactly what went wrong can be helpful. This can also be used by the user to report the errors back to us.
production/db/core/src/db_server.cpp
Outdated
if (errno == EADDRINUSE) | ||
{ | ||
cerr << "ERROR: bind() failed! - " << (::strerror(errno)) << endl; | ||
cerr << "The Gaia Database Server cannot start because another instance is already running. Please stop any instances of the server that are running." << endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could there be non running instances of the server that could cause an issue?
Maybe
Stop any instances of the server and try again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could there be non running instances of the server that could cause an issue?
Potentially you could create an address with the same name, but very unlikely.
Stop any instances of the server and try again.
Changed.
The output of a successful run:
The output of an unsuccessful run: