forked from electron/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: event with invalid timestamp in trace log (electron#31349)
When node is started within Electron's environment it doesn't initialize v8 and time of v8's start is never set. As a result we log v8's start time as 0 and it breaks timestamps in the trace log. With this change we log v8's start time only when it was initialized by node.
- Loading branch information
1 parent
0c95531
commit 79f8255
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
patches/node/fix_event_with_invalid_timestamp_in_trace_log.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Cezary Kulakowski <[email protected]> | ||
Date: Fri, 8 Oct 2021 11:18:58 +0200 | ||
Subject: fix: event with invalid timestamp in trace log | ||
|
||
When node is started within Electron's environment it doesn't | ||
initialize v8 and time of v8's start is never set. As a result | ||
we log v8's start time as 0 and it breaks timestamps in the | ||
trace log. With this change we log v8's start time only when | ||
it was initialized by node. | ||
|
||
diff --git a/src/env.cc b/src/env.cc | ||
index 16af6aec3791df1363682f1ed024c52208b9a8f6..ada0faa93bc223ffbea79a4308796df73ea8ae4e 100644 | ||
--- a/src/env.cc | ||
+++ b/src/env.cc | ||
@@ -461,8 +461,10 @@ void Environment::InitializeMainContext(Local<Context> context, | ||
environment_start_time_); | ||
performance_state_->Mark(performance::NODE_PERFORMANCE_MILESTONE_NODE_START, | ||
per_process::node_start_time); | ||
- performance_state_->Mark(performance::NODE_PERFORMANCE_MILESTONE_V8_START, | ||
- performance::performance_v8_start); | ||
+ if (per_process::v8_initialized) { | ||
+ performance_state_->Mark(performance::NODE_PERFORMANCE_MILESTONE_V8_START, | ||
+ performance::performance_v8_start); | ||
+ } | ||
} | ||
|
||
Environment::~Environment() { |