Commit 134a60c
src: fix race condition in debug signal on exit
Before this commit, sending a SIGUSR1 at program exit could trigger a
hard to reproduce race condition where `v8::Debug::DebugBreak(isolate)`
got called when the isolate was in the process of being torn down.
A similar race condition is in theory possible when sending signals
to two threads simultaneously but I haven't been able to reproduce
that myself (and I tried, oh how I tried.)
This commit fixes the race condition by turning `node_isolate` into
a `std::atomic` and using it as an ad hoc synchronization primitive
in places where that is necessary.
A bare minimum std::atomic polyfill is added for OS X because Apple
wouldn't be Apple if things just worked out of the box.
PR-URL: #3528
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 8057315 commit 134a60cCopy full SHA for 134a60c
File tree
Expand file treeCollapse file tree
2 files changed
+60
-13
lines changedOpen diff view settings
Filter options
- src
Expand file treeCollapse file tree
2 files changed
+60
-13
lines changedOpen diff view settings
Collapse file
src/atomic-polyfill.h
Copy file name to clipboard+18Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
Collapse file
+42-13Lines changed: 42 additions & 13 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
86 | 86 | |
87 | 87 | |
88 | 88 | |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
89 | 97 | |
90 | 98 | |
91 | 99 | |
| ||
153 | 161 | |
154 | 162 | |
155 | 163 | |
156 | | - |
| 164 | + |
157 | 165 | |
158 | 166 | |
159 | 167 | |
| ||
3410 | 3418 | |
3411 | 3419 | |
3412 | 3420 | |
| 3421 | + |
| 3422 | + |
| 3423 | + |
| 3424 | + |
| 3425 | + |
| 3426 | + |
| 3427 | + |
| 3428 | + |
| 3429 | + |
| 3430 | + |
| 3431 | + |
| 3432 | + |
3413 | 3433 | |
3414 | 3434 | |
| 3435 | + |
| 3436 | + |
| 3437 | + |
| 3438 | + |
| 3439 | + |
| 3440 | + |
3415 | 3441 | |
3416 | 3442 | |
3417 | 3443 | |
3418 | | - |
3419 | | - |
| 3444 | + |
| 3445 | + |
3420 | 3446 | |
3421 | 3447 | |
3422 | 3448 | |
3423 | 3449 | |
3424 | 3450 | |
3425 | | - |
| 3451 | + |
| 3452 | + |
3426 | 3453 | |
| 3454 | + |
3427 | 3455 | |
3428 | 3456 | |
3429 | 3457 | |
3430 | 3458 | |
3431 | 3459 | |
3432 | | - |
3433 | | - |
3434 | | - |
| 3460 | + |
3435 | 3461 | |
3436 | 3462 | |
3437 | 3463 | |
| ||
3485 | 3511 | |
3486 | 3512 | |
3487 | 3513 | |
3488 | | - |
3489 | | - |
| 3514 | + |
3490 | 3515 | |
3491 | 3516 | |
3492 | 3517 | |
| ||
4006 | 4031 | |
4007 | 4032 | |
4008 | 4033 | |
4009 | | - |
| 4034 | + |
| 4035 | + |
4010 | 4036 | |
4011 | 4037 | |
4012 | 4038 | |
| ||
4016 | 4042 | |
4017 | 4043 | |
4018 | 4044 | |
4019 | | - |
| 4045 | + |
4020 | 4046 | |
4021 | 4047 | |
4022 | 4048 | |
| ||
4070 | 4096 | |
4071 | 4097 | |
4072 | 4098 | |
| 4099 | + |
| 4100 | + |
| 4101 | + |
| 4102 | + |
| 4103 | + |
4073 | 4104 | |
4074 | 4105 | |
4075 | 4106 | |
4076 | 4107 | |
4077 | | - |
4078 | | - |
4079 | 4108 | |
4080 | 4109 | |
4081 | 4110 | |
|
0 commit comments