From e7c80b320328fb223cdfb825f9a7bb8c7cfb9a26 Mon Sep 17 00:00:00 2001 From: Waleed Khan Date: Mon, 9 Dec 2019 09:45:47 -0800 Subject: [PATCH] Improve error message for `check_workers_exit` in `hh_shared.c` Summary: The assertion failure message is currently just a line number in `hh_shared.c`. Reviewed By: jewelpit, ljw1004 Differential Revision: D18867184 fbshipit-source-id: b7b77c965096876ab8d9b66da67f17e97ebf707e --- hphp/hack/src/heap/hh_shared.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hphp/hack/src/heap/hh_shared.c b/hphp/hack/src/heap/hh_shared.c index 3551567dcca..b9007e0f0c0 100644 --- a/hphp/hack/src/heap/hh_shared.c +++ b/hphp/hack/src/heap/hh_shared.c @@ -1217,8 +1217,13 @@ CAMLprim value hh_assert_allow_dependency_table_reads (void) { } void check_should_exit(void) { - assert(workers_should_exit != NULL); - if(worker_can_exit && *workers_should_exit) { + if (workers_should_exit == NULL) { + caml_failwith( + "`check_should_exit` failed: `workers_should_exit` was uninitialized. " + "Did you forget to call one of `hh_connect` or `hh_shared_init` " + "to initialize shared memory before accessing it?" + ); + } else if (*workers_should_exit) { static value *exn = NULL; if (!exn) exn = caml_named_value("worker_should_exit"); caml_raise_constant(*exn); -- 2.11.4.GIT