Skip to content

Commit

Permalink
[#3676] Handle overall exceptions in a better way
Browse files Browse the repository at this point in the history
Summary: We call sys.exit but that doesn't exit the program because of the bg threads still running. Instead let's call log_error_and_exit which does proper teardown

Test Plan:
Run regular case, run a scenario with post_install.sh missing (which earlier hung at the prompt) - we see the following output if post_install.sh is missing

```
15:50 $ bin/yugabyted start
Starting yugabyted...
/ Running system checks...yugabyted crashed. For troubleshooting, contact us on https://www.yugabyte.com/slack or check our FAQ at https://docs.yugabyte.com/latest/faq/
Traceback (most recent call last):
  File "bin/yugabyted", line 1024, in run
    args.func()
  File "bin/yugabyted", line 150, in start
    self.start_processes()
  File "bin/yugabyted", line 482, in start_processes
    self.post_install_yb()
  File "bin/yugabyted", line 659, in post_install_yb
    post_install_script_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

For more information, check the logs in /tmp/ybd-test-708655a4-889c-4a93-a139-43b0fa334104/yugabyte-2.1.0.0/var/logs
```

Reviewers: wesley

Reviewed By: wesley

Subscribers: yugaware

Differential Revision: https://phabricator.dev.yugabyte.com/D8003
  • Loading branch information
iSignal committed Feb 20, 2020
1 parent c504dfc commit f00f139
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions bin/yugabyted
Original file line number Diff line number Diff line change
Expand Up @@ -1027,8 +1027,7 @@ class ControlScript(object):
"{} crashed. For troubleshooting, contact us on {} or check our FAQ at {}".format(
SCRIPT_NAME, Output.make_underline(SLACK_LINK),
Output.make_underline(HELP_LINK)))
Output.log(traceback.format_exc(), logging.ERROR)
sys.exit(1)
Output.log_error_and_exit(traceback.format_exc())

def advertise_ip(self):
bind_ip = self.configs.saved_data.get("bind_ip")
Expand Down

0 comments on commit f00f139

Please sign in to comment.