fix_capture_embedder_exceptions_before_entering_v8.patch 972 B

12345678910111213141516171819202122232425
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: deepak1556 <[email protected]>
  3. Date: Tue, 26 Dec 2023 02:10:42 +0900
  4. Subject: fix: capture embedder exceptions before entering V8
  5. Upstrem bug: https://github.com/nodejs/node-v8/issues/274
  6. The patch only addresses the callsites that triggered failing DCHECKS
  7. in the nodejs test suite. Need to be followed-up with upstream
  8. on the broader change as there maybe other callsites.
  9. diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc
  10. index 70db7ddbeab5963f1bdf6cb05ee2763d76011cec..6ffe2a2ad01f33ff68c6646df330ec3ac7781a19 100644
  11. --- a/src/handle_wrap.cc
  12. +++ b/src/handle_wrap.cc
  13. @@ -148,6 +148,9 @@ void HandleWrap::OnClose(uv_handle_t* handle) {
  14. wrap->OnClose();
  15. wrap->handle_wrap_queue_.Remove();
  16. + if (env->isolate()->IsExecutionTerminating())
  17. + return;
  18. +
  19. if (!wrap->persistent().IsEmpty() &&
  20. wrap->object()
  21. ->Has(env->context(), env->handle_onclose_symbol())