From 9aa2e0ad452ca451eda9fe16e9c2bd2fabdeb71b Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 7 Dec 2021 15:17:45 -0800 Subject: [PATCH] upgrade-zulip-from-git: Improve webpack failure error handling. We've had a number of unhappy reports of upgrades failing due to webpack requiring too much memory. While the previous commit will likely fix this issue for everyone, it's worth improving the error message for failures here. We avoid doing the stop+retry ourselves, because that could cause an outage in a production system if webpack fails for another reason. Fixes #20105. --- scripts/lib/upgrade-zulip-stage-2 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/lib/upgrade-zulip-stage-2 b/scripts/lib/upgrade-zulip-stage-2 index cb33b222f1..0039ef8be7 100755 --- a/scripts/lib/upgrade-zulip-stage-2 +++ b/scripts/lib/upgrade-zulip-stage-2 @@ -215,7 +215,15 @@ elif args.from_git: # update-prod-static with the Git upgrade process. But it'll fail # safely; this seems like a worthwhile tradeoff to minimize downtime. logging.info("Building static assets...") - subprocess.check_call(["./tools/update-prod-static"], preexec_fn=su_to_zulip) + try: + subprocess.check_call(["./tools/update-prod-static"], preexec_fn=su_to_zulip) + except subprocess.CalledProcessError: + logging.error("Failed to build static assets.") + if IS_SERVER_UP: + logging.error("Usually the cause is insufficient free RAM to run webpack.") + logging.error("Try stopping the Zulip server (scripts/stop-server) and trying again.") + sys.exit(1) + logging.info("Caching Zulip Git version...") subprocess.check_call(["./tools/cache-zulip-git-version"], preexec_fn=su_to_zulip) else: