@zq-silk/yui 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
|
@@ -547,8 +547,12 @@ export async function main() {
|
|
|
547
547
|
validateCompatibleFileTaskStore(home);
|
|
548
548
|
const controllerMethod = method;
|
|
549
549
|
const updateHandoverOwner = process.env.YUI_UPDATE_HANDOVER_OWNER_PID;
|
|
550
|
+
// A pre-fix updater cannot pass the owner environment variable to the
|
|
551
|
+
// activated restart child, but it remains that child's direct parent while
|
|
552
|
+
// holding the exact handover lock. Inherit only that OS-backed relationship;
|
|
553
|
+
// every unrelated live lock still compares foreign and fails closed.
|
|
550
554
|
const updateHandoverOwnerPid = updateHandoverOwner === undefined
|
|
551
|
-
? undefined
|
|
555
|
+
? (Number.isSafeInteger(process.ppid) && process.ppid > 0 ? process.ppid : undefined)
|
|
552
556
|
: Number(updateHandoverOwner);
|
|
553
557
|
if (updateHandoverOwnerPid !== undefined
|
|
554
558
|
&& (!Number.isSafeInteger(updateHandoverOwnerPid) || updateHandoverOwnerPid < 1)) {
|
|
@@ -589,7 +589,7 @@ async function executeSqliteInPlaceUpgrade(options, classification, now, callerP
|
|
|
589
589
|
finally {
|
|
590
590
|
db.close();
|
|
591
591
|
}
|
|
592
|
-
});
|
|
592
|
+
}, options.externalUpgradeFenceOwnerPid ?? callerPid);
|
|
593
593
|
}
|
|
594
594
|
catch (error) {
|
|
595
595
|
unexpected = error;
|
|
@@ -1358,7 +1358,7 @@ function executeFenced(options, classification, target, callerPid, now, switchSt
|
|
|
1358
1358
|
? {}
|
|
1359
1359
|
: { backupPath: report.switch.backupPath })
|
|
1360
1360
|
};
|
|
1361
|
-
});
|
|
1361
|
+
}, options.externalUpgradeFenceOwnerPid ?? callerPid);
|
|
1362
1362
|
}
|
|
1363
1363
|
catch (error) {
|
|
1364
1364
|
if (!(error instanceof UpgradeFenceError))
|
|
@@ -37,12 +37,13 @@ const COORDINATION_LOCK_MIN_AGE_MS = 1_000;
|
|
|
37
37
|
* A hook that passed a check before an upgrade placed its fence either owns the
|
|
38
38
|
* lock and finishes before cutover, or waits and receives an explicit
|
|
39
39
|
* UpgradeFenceError after the cutover holder releases it. There is no second
|
|
40
|
-
* scan or retry protocol hidden in this helper.
|
|
40
|
+
* scan or retry protocol hidden in this helper. A staged updater child passes
|
|
41
|
+
* its already-authenticated parent fence owner through this same boundary.
|
|
41
42
|
*/
|
|
42
|
-
export function withUpgradeCoordinationLock(home, execute) {
|
|
43
|
+
export function withUpgradeCoordinationLock(home, execute, fenceOwnerPid = process.pid) {
|
|
43
44
|
const release = acquireUpgradeCoordinationLock(home);
|
|
44
45
|
try {
|
|
45
|
-
assertUpgradeAdmission(home);
|
|
46
|
+
assertUpgradeAdmission(home, fenceOwnerPid);
|
|
46
47
|
return execute();
|
|
47
48
|
}
|
|
48
49
|
finally {
|
|
@@ -57,8 +58,8 @@ export function withUpgradeCoordinationLock(home, execute) {
|
|
|
57
58
|
* avoiding a permanent post-promote hook deadlock. A malformed marker with a
|
|
58
59
|
* missing Home still fails closed because its recovery phase cannot be trusted.
|
|
59
60
|
*/
|
|
60
|
-
export function assertUpgradeAdmission(home) {
|
|
61
|
-
assertHomeWritable(home);
|
|
61
|
+
export function assertUpgradeAdmission(home, fenceOwnerPid = process.pid) {
|
|
62
|
+
assertHomeWritable(home, fenceOwnerPid);
|
|
62
63
|
const progressPath = switchProgressPath(home);
|
|
63
64
|
if (!existsSync(progressPath))
|
|
64
65
|
return;
|