2021-07-21 13:33:25 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: VerteDinde <khammond@slack-corp.com>
|
|
|
|
Date: Thu, 15 Jul 2021 12:16:50 -0700
|
|
|
|
Subject: chore: add gin::wrappable wrapperinfo crash key
|
|
|
|
|
|
|
|
This patch adds an additional crash key for gin::Wrappable, to help
|
|
|
|
debug a crash that is occurring during garbage collection in SecondWeakCallback.
|
|
|
|
|
|
|
|
The crash seems to be due to a class that is holding a reference to
|
|
|
|
gin::Wrappable even after being deleted. This added crash key compares
|
|
|
|
the soon-to-be-deleted WrapperInfo with known WrapperInfo components to
|
|
|
|
help determine where the crash originated from.
|
|
|
|
|
|
|
|
This patch should not be upstreamed, and can be removed in Electron 15 and
|
|
|
|
beyond once we identify the cause of the crash.
|
|
|
|
|
2021-08-24 00:52:17 +00:00
|
|
|
diff --git a/gin/BUILD.gn b/gin/BUILD.gn
|
|
|
|
index c6059fdb0e0f74ee3ef78c5517634ed5a36f1b10..e16b2ec43b98c3b8724fd85085a33fe52a1e1979 100644
|
|
|
|
--- a/gin/BUILD.gn
|
|
|
|
+++ b/gin/BUILD.gn
|
|
|
|
@@ -88,6 +88,10 @@ component("gin") {
|
|
|
|
frameworks = [ "CoreFoundation.framework" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (!is_mas_build) {
|
|
|
|
+ public_deps += [ "//components/crash/core/common:crash_key" ]
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
configs += [
|
|
|
|
"//tools/v8_context_snapshot:use_v8_context_snapshot",
|
|
|
|
"//v8:external_startup_data",
|
2021-07-21 13:33:25 +00:00
|
|
|
diff --git a/gin/wrappable.cc b/gin/wrappable.cc
|
2021-08-18 20:51:40 +00:00
|
|
|
index fe07eb94a8e679859bba6d76ff0d6ee86bd0c67e..ecb0aa2c4ec57e1814f4c94194e775440f4e35ee 100644
|
2021-07-21 13:33:25 +00:00
|
|
|
--- a/gin/wrappable.cc
|
|
|
|
+++ b/gin/wrappable.cc
|
2021-08-18 20:51:40 +00:00
|
|
|
@@ -8,6 +8,11 @@
|
2021-07-21 13:33:25 +00:00
|
|
|
#include "gin/object_template_builder.h"
|
|
|
|
#include "gin/per_isolate_data.h"
|
|
|
|
|
|
|
|
+#if !defined(MAS_BUILD)
|
2021-08-18 20:51:40 +00:00
|
|
|
+#include "components/crash/core/common/crash_key.h"
|
2021-07-21 13:33:25 +00:00
|
|
|
+#include "electron/shell/common/crash_keys.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
namespace gin {
|
|
|
|
|
|
|
|
WrappableBase::WrappableBase() = default;
|
2021-08-18 20:51:40 +00:00
|
|
|
@@ -36,6 +41,15 @@ void WrappableBase::FirstWeakCallback(
|
2021-07-21 13:33:25 +00:00
|
|
|
void WrappableBase::SecondWeakCallback(
|
|
|
|
const v8::WeakCallbackInfo<WrappableBase>& data) {
|
|
|
|
WrappableBase* wrappable = data.GetParameter();
|
|
|
|
+
|
|
|
|
+#if !defined(MAS_BUILD)
|
2021-08-18 20:51:40 +00:00
|
|
|
+ WrapperInfo* wrapperInfo = static_cast<WrapperInfo*>(data.GetInternalField(0));
|
|
|
|
+ std::string location = electron::crash_keys::GetCrashValueForGinWrappable(wrapperInfo);
|
|
|
|
+
|
|
|
|
+ static crash_reporter::CrashKeyString<32> crash_key("gin-wrappable-fatal.location");
|
|
|
|
+ crash_reporter::ScopedCrashKeyString auto_clear(&crash_key, location);
|
2021-07-21 13:33:25 +00:00
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
delete wrappable;
|
|
|
|
}
|
|
|
|
|