You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: doc/guides/maintaining-V8.md
+86-35
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,17 @@
1
-
# Maintaining V8 in Node
1
+
# Maintaining V8 in Node.js
2
2
3
3
# Background
4
4
5
-
V8 follows the Chromium release schedule. The support horizon for Chromium is very different from the support horizon that Node.js needs to provide to its users. As a result Node.js needs to support a version of V8 for quite a bit longer than what upstream needs to support. Since V8 doesn't have an LTS supported branch, there is no official process around how the V8 branches in Node are maintained.
5
+
V8 follows the Chromium release schedule. The support horizon for Chromium is
6
+
very different from the support horizon that Node.js needs to provide to its
7
+
users. As a result Node.js needs to support a version of V8 for quite a bit
8
+
longer than what upstream needs to support. Since V8 doesn't have an LTS
9
+
supported branch, there is no official process around how the V8 branches in
10
+
Node.js are maintained.
6
11
7
-
This document attempts to document the current processes and proposes a workflow for maintaining the V8 branches in Node.js LTS and Current releases and how the Node and V8 teams at Google can help.
12
+
This document attempts to document the current processes and proposes a workflow
13
+
for maintaining the V8 branches in Node.js LTS and Current releases and how the
14
+
Node.js and V8 teams at Google can help.
8
15
9
16
# V8 Release Schedule
10
17
@@ -16,7 +23,8 @@ For example, at the time of this writing:
16
23
***Beta**: V8 5.5 is currently in beta. It will be promoted to stable next; approximately 6 weeks after V8 5.4 shipped as stable.
17
24
***Master**: V8 tip-of-tree corresponds to V8 5.6. This branch gets regularly released as part of the Chromium **canary** builds. This branch will be promoted to beta next when V8 5.5 ships as stable.
18
25
19
-
All older branches are considered **abandoned**, and are not maintained by the V8 team.
26
+
All older branches are considered **abandoned**, and are not maintained by the
27
+
V8 team.
20
28
21
29
## V8 merge process overview
22
30
@@ -29,9 +37,11 @@ The process for backporting bug fixes to active branches is officially documente
29
37
* Merge requests to an abandoned branch will be rejected.
30
38
* Only bug fixes are accepted for backporting.
31
39
32
-
# Node Support Requirements
40
+
# Node.js Support Requirements
33
41
34
-
At any given time Node needs to be maintaining a few different V8 branches for the various Current, LTS, and nightly releases. At present this list includes the following branches<sup>1</sup>:
42
+
At any given time Node.js needs to be maintaining a few different V8 branches
43
+
for the various Current, LTS, and nightly releases. At present this list
44
+
includes the following branches<sup>1</sup>:
35
45
36
46
<table>
37
47
<tr>
@@ -49,7 +59,7 @@ At any given time Node needs to be maintaining a few different V8 branches for t
49
59
</td>
50
60
</tr>
51
61
<tr>
52
-
<td>Node v4.x
62
+
<td>Node.js v4.x
53
63
</td>
54
64
<td>2015-10-01
55
65
</td>
@@ -63,7 +73,7 @@ At any given time Node needs to be maintaining a few different V8 branches for t
63
73
</td>
64
74
</tr>
65
75
<tr>
66
-
<td>Node v6.x
76
+
<td>Node.js v6.x
67
77
</td>
68
78
<td>2016-04-01
69
79
</td>
@@ -77,7 +87,7 @@ At any given time Node needs to be maintaining a few different V8 branches for t
77
87
</td>
78
88
</tr>
79
89
<tr>
80
-
<td>Node v7.x
90
+
<td>Node.js v7.x
81
91
</td>
82
92
<td>2016-10-01
83
93
</td>
@@ -107,17 +117,22 @@ At any given time Node needs to be maintaining a few different V8 branches for t
107
117
</table>
108
118
109
119
110
-
The versions of V8 used in Node v4.x and v6.x have already been abandoned by upstream V8. However, Node.js needs to continue supporting these branches for many months (Current branches) or several years (LTS branches).
120
+
The versions of V8 used in Node.js v4.x and v6.x have already been abandoned by
121
+
upstream V8. However, Node.js needs to continue supporting these branches for
122
+
many months (Current branches) or several years (LTS branches).
111
123
112
124
# Maintenance Process
113
125
114
-
Once a bug in Node.js has been identified to be caused by V8, the first step is to identify the versions of Node and V8 affected. The bug may be present in multiple different locations, each of which follows a slightly different process.
126
+
Once a bug in Node.js has been identified to be caused by V8, the first step is
127
+
to identify the versions of Node.js and V8 affected. The bug may be present in
128
+
multiple different locations, each of which follows a slightly different
129
+
process.
115
130
116
131
* Unfixed bugs. The bug exists in the V8 master branch.
117
132
* Fixed, but needs backport. The bug may need porting to one or more branches.
118
133
* Backporting to active branches.
119
134
* Backporting to abandoned branches.
120
-
* Backports identified by the V8 team. Bugs identified by upstream V8 that we haven't encountered in Node yet.
135
+
* Backports identified by the V8 team. Bugs identified by upstream V8 that we haven't encountered in Node.js yet.
121
136
122
137
## Unfixed Upstream Bugs
123
138
@@ -127,7 +142,7 @@ If the bug can be reproduced on the [`vee-eight-lkgr` branch](https://github.com
127
142
* Make sure to include a link to the corresponding Node.js issue (if one exists).
128
143
* If the fix is simple enough, you may fix it yourself; [contributions](https://github.com/v8/v8/wiki/Contributing) are welcome.
129
144
* V8's build waterfall tests your change.
130
-
* Once the bug is fixed it may still need backporting, if it exists in other V8 branches that are still active or are branches that Node cares about. Follow the process for backporting below.
145
+
* Once the bug is fixed it may still need backporting, if it exists in other V8 branches that are still active or are branches that Node.js cares about. Follow the process for backporting below.
131
146
132
147
## Backporting to Active Branches
133
148
@@ -142,23 +157,28 @@ If the bug exists in any of the active V8 branches, we may need to get the fix b
142
157
* Attach *merge-request-x.x* labels to the bug for any active branches that still contain the bug. (e.g. merge-request-5.3, merge-request-5.4)
143
158
* Add ofrobots-at-google.com to the cc list.
144
159
* Once the merge has been approved, it should be merged using the [merge script documented in the V8 wiki](https://github.com/v8/v8/wiki/Merging%20&%20Patching). Merging requires commit access to the V8 repository. If you don't have commit access you can indicate someone on the V8 team can do the merge for you.
145
-
* It is possible that the merge request may not get approved, for example if it is considered to be a feature or otherwise too risky for V8 stable. In such cases we float the patch on the Node side. See the process on 'Backporting to Abandoned branches'.
160
+
* It is possible that the merge request may not get approved, for example if it is considered to be a feature or otherwise too risky for V8 stable. In such cases we float the patch on the Node.js side. See the process on 'Backporting to Abandoned branches'.
146
161
* Once the fix has been merged upstream, it can be picked up during an update of the V8 branch, (see below).
147
162
148
163
## Backporting to Abandoned Branches
149
164
150
-
Abandoned V8 branches are supported in the Node.js V8 repository. The fix needs to be cherry-picked in the Node.js repository and V8-CI must test the change.
165
+
Abandoned V8 branches are supported in the Node.js V8 repository. The fix needs
166
+
to be cherry-picked in the Node.js repository and V8-CI must test the change.
151
167
152
168
* For each abandoned V8 branch corresponding to an LTS branch that is affected by the bug:
153
169
* Open a cherry-pick PR on nodejs/node targeting the appropriate *vY.x-staging* branch (e.g. *v6.x-staging* to fix an issue in V8-5.1).
154
170
* Increase the patch level version in v8-version.h. This will not cause any problems with versioning because V8 will not publish other patches for this branch, so Node.js can effectively bump the patch version.
155
171
* In some cases the patch may require extra effort to merge in case V8 has changed substantially. For important issues we may be able to lean on the V8 team to get help with reimplementing the patch.
156
-
* Run Node's[V8-CI](https://ci.nodejs.org/job/node-test-commit-v8-linux/) in addition to the [Node CI](https://ci.nodejs.org/job/node-test-pull-request/).
172
+
* Run the Node.js[V8-CI](https://ci.nodejs.org/job/node-test-commit-v8-linux/) in addition to the [Node.js CI](https://ci.nodejs.org/job/node-test-pull-request/).
157
173
158
-
An example for workflow how to cherry-pick consider the following bug: https://crbug.com/v8/5199. From the bug we can see that it was merged by V8 into 5.2 and 5.3, and not into V8 5.1 (since it was already abandoned). Since Node.js `v6.x` uses V8 5.1, the fix needed to cherry-picked. To cherry-pick, here's an example workflow:
174
+
An example for workflow how to cherry-pick consider the following bug:
175
+
https://crbug.com/v8/5199. From the bug we can see that it was merged by V8 into
176
+
5.2 and 5.3, and not into V8 5.1 (since it was already abandoned). Since Node.js
177
+
`v6.x` uses V8 5.1, the fix needed to cherry-picked. To cherry-pick, here's an
178
+
example workflow:
159
179
160
180
* Download and apply the commit linked-to in the issue (in this case a51f429). `curl -L https://github.com/v8/v8/commit/a51f429.patch | git apply --directory=deps/v8`. If the branches have diverged significantly, this may not apply cleanly. It may help to try to cherry-pick the merge to the oldest branch that was done upstream in V8. In this example, this would be the patch from the merge to 5.2. The hope is that this would be closer to the V8 5.1, and has a better chance of applying cleanly. If you're stuck, feel free to ping @ofrobots for help.
161
-
* Modify the commit message to match the format we use for V8 backports. You may want to add extra description if necessary to indicate the impact of the fix on Node. In this case the original issue was descriptive enough. Example:
181
+
* Modify the commit message to match the format we use for V8 backports. You may want to add extra description if necessary to indicate the impact of the fix on Node.js. In this case the original issue was descriptive enough. Example:
162
182
```
163
183
deps: cherry-pick a51f429 from V8 upstream
164
184
@@ -182,24 +202,38 @@ PR-URL: <pr link>
182
202
183
203
## Backports Identified by the V8 team
184
204
185
-
For bugs found through the browser or other channels, the V8 team marks bugs that might be applicable to the abandoned branches in use by Node.js. This is done through manual tagging by the V8 team and through an automated process that tags any fix that gets backported to the stable branch (as it is likely candidate for backporting further).
205
+
For bugs found through the browser or other channels, the V8 team marks bugs
206
+
that might be applicable to the abandoned branches in use by Node.js. This is
207
+
done through manual tagging by the V8 team and through an automated process that
208
+
tags any fix that gets backported to the stable branch (as it is likely
209
+
candidate for backporting further).
186
210
187
211
Such fixes are tagged with the following labels in the V8 issue tracker:
188
212
189
-
*`NodeJS-Backport-Review` ([V8](https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Review), [Chromium](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Review)): to be reviewed if this is applicable to abandoned branches in use by Node.js. This list if regularly reviewed by the node team at Google to determine applicability to Node.js.
213
+
*`NodeJS-Backport-Review` ([V8](https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Review), [Chromium](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Review)): to be reviewed if this is applicable to abandoned branches in use by Node.js. This list if regularly reviewed by the Node.js team at Google to determine applicability to Node.js.
190
214
*`NodeJS-Backport-Approved` ([V8](https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Approved), [Chromium](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Approved)): marks bugs that are deemed relevant to Node.js and should be backported.
191
215
*`NodeJS-Backport-Done` ([V8](https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Done), [Chromium](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Done)): Backport for Node.js has been performed already.
192
216
*`NodeJS-Backport-Rejected` ([V8](https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Rejected), [Chromium](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Rejected)): Backport for Node.js is not desired.
193
217
194
-
The backlog of issues with such is regularly reviewed by the node-team at Google to shepherd through the backport process. External contributors are welcome to collaborate on the backport process as well. Note that some of the bugs may be security issues and will not be visible to external collaborators.
218
+
The backlog of issues with such is regularly reviewed by the node-team at Google
219
+
to shepherd through the backport process. External contributors are welcome to
220
+
collaborate on the backport process as well. Note that some of the bugs may be
221
+
security issues and will not be visible to external collaborators.
195
222
196
223
# Updating V8
197
224
198
-
Node keeps a vendored copy of V8 inside of deps/ directory. In addition Node may need to float patches that do not exist upstream. This means that some care may need to be taken to update the vendored copy of V8.
225
+
Node.js keeps a vendored copy of V8 inside of deps/ directory. In addition
226
+
Node.js may need to float patches that do not exist upstream. This means that
227
+
some care may need to be taken to update the vendored copy of V8.
199
228
200
229
## Minor updates (patch level)
201
230
202
-
Because there may be floating patches on the version of V8 in Node.js, it is safest to apply the patch level updates as a patch. For example, imagine that upstream V8 is at 5.0.71.47 and Node.js is at 5.0.71.32. It would be best to compute the diff between these tags on the V8 repository, and then apply that patch on the copy of V8 in Node.js. This should preserve the patches/backports that Node.js may be floating (or else cause a merge conflict).
231
+
Because there may be floating patches on the version of V8 in Node.js, it is
232
+
safest to apply the patch level updates as a patch. For example, imagine that
233
+
upstream V8 is at 5.0.71.47 and Node.js is at 5.0.71.32. It would be best to
234
+
compute the diff between these tags on the V8 repository, and then apply that
235
+
patch on the copy of V8 in Node.js. This should preserve the patches/backports
236
+
that Node.js may be floating (or else cause a merge conflict).
# You may want to amend the commit message to describe the nature of the update
217
251
```
218
252
219
-
V8 also keeps tags of the form *5.4-lkgr* which point to the *Last Known Good Revision* from the 5.4 branch that can be useful in the update process above.
253
+
V8 also keeps tags of the form *5.4-lkgr* which point to the *Last Known Good
254
+
Revision* from the 5.4 branch that can be useful in the update process above.
220
255
221
256
222
257
## Major Updates
223
258
224
-
We upgrade the version of V8 in Node.js master whenever a V8 release goes stable upstream, that is, whenever a new release of Chrome comes out.
259
+
We upgrade the version of V8 in Node.js master whenever a V8 release goes stable
260
+
upstream, that is, whenever a new release of Chrome comes out.
225
261
226
-
Upgrading major versions would be much harder to do with the patch mechanism above. A better strategy is to
262
+
Upgrading major versions would be much harder to do with the patch mechanism
263
+
above. A better strategy is to
227
264
228
265
1. Audit the current master branch and look at the patches that have been floated since the last major V8 update.
229
266
1. Replace the copy of V8 in Node.js with a fresh checkout of the latest stable V8 branch. Special care must be taken to recursively update the DEPS that V8 has a compile time dependency on (at the moment of this writing, these are only trace_event and gtest_prod.h)
@@ -235,21 +272,25 @@ To audit for floating patches:
235
272
git log --oneline deps/v8
236
273
```
237
274
238
-
To replace the copy of V8 in Node, use the '[update-v8](https://gist.github.com/targos/8da405e96e98fdff01a395bed365b816)' script<sup>2</sup>. For example, if you want to replace the copy of V8 in Node.js with the branch-head for V8 5.1 branch:
275
+
To replace the copy of V8 in Node.js, use the '[update-v8](https://gist.github.com/targos/8da405e96e98fdff01a395bed365b816)' script<sup>2</sup>. For example, if you want to replace the copy of V8 in Node.js with the branch-head for V8 5.1 branch:
239
276
240
277
```shell
241
278
cd$NODE_DIR
242
279
rm -rf deps/v8
243
280
path/to/update-v8 branch-heads/5.1
244
281
```
245
282
246
-
You may want to look at the commits created by the above scripts, and squash them once you have reviewed them.
283
+
You may want to look at the commits created by the above scripts, and squash
284
+
them once you have reviewed them.
247
285
248
286
This should be followed up with manual refloating of all relevant patches.
249
287
250
288
# Proposal: Using a fork repo to track upstream V8
251
289
252
-
The fact that Node.js keeps a vendored, potentially edited copy of V8 in deps/ makes the above processes a bit complicated. An alternative proposal would be to create a fork of V8 at nodejs/v8 that would be used to maintain the V8 branches. This has several benefits:
290
+
The fact that Node.js keeps a vendored, potentially edited copy of V8 in deps/
291
+
makes the above processes a bit complicated. An alternative proposal would be to
292
+
create a fork of V8 at nodejs/v8 that would be used to maintain the V8 branches.
293
+
This has several benefits:
253
294
254
295
* The process to update the version of V8 in Node.js could be automated to track the tips of various V8 branches in nodejs/v8.
255
296
* It would simplify cherry-picking and porting of fixes between branches as the version bumps in v8-version.h would happen as part of this update instead of on every change.
@@ -259,17 +300,27 @@ The fact that Node.js keeps a vendored, potentially edited copy of V8 in deps/ m
259
300
260
301
This would require some tooling to:
261
302
262
-
* A script that would update the V8 in a specific Node branch with V8 from upstream (dependent on branch abandoned vs. active).
303
+
* A script that would update the V8 in a specific Node.js branch with V8 from upstream (dependent on branch abandoned vs. active).
263
304
* We need a script to bump V8 version numbers when a new version of V8 is promoted from nodejs/v8 to nodejs/node.
264
305
* Enabled the V8-CI build in Jenkins to build from the nodejs/v8 fork.
265
306
266
307
# Proposal: Dealing with the need to float patches to a stable/beta
267
308
268
-
Sometimes upstream V8 may not want to merge a fix to their stable branches, but we might. An example of this would be a fix for a performance regression that only affects Node.js and not the browser. At the moment we don't have a mechanism to deal with this situation. If we float a patch and bump the V8 version, we might run into a problem if upstream releases a fix with the same version number.
269
-
270
-
One idea we have been kicking around is that we could move to a 5-place version number in V8, e.g.: 5.4.500.30.${embedder}. The ${embedder} represents the number of patches an embedder is floating on top of an official V8 version. This would also help with auditing the floating patches in the Node commit history.
271
-
272
-
We are trying this out in https://github.com/nodejs/node/pull/9754. If this ends up working, we will investigate making this change upstream.
309
+
Sometimes upstream V8 may not want to merge a fix to their stable branches, but
310
+
we might. An example of this would be a fix for a performance regression that
311
+
only affects Node.js and not the browser. At the moment we don't have a
312
+
mechanism to deal with this situation. If we float a patch and bump the V8
313
+
version, we might run into a problem if upstream releases a fix with the same
314
+
version number.
315
+
316
+
One idea we have been kicking around is that we could move to a 5-place version
317
+
number in V8, e.g.: 5.4.500.30.${embedder}. The ${embedder} represents the
318
+
number of patches an embedder is floating on top of an official V8 version. This
319
+
would also help with auditing the floating patches in the Node.js commit
320
+
history.
321
+
322
+
We are trying this out in https://github.com/nodejs/node/pull/9754. If this ends
323
+
up working, we will investigate making this change upstream.
0 commit comments