Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.

Commit 292d69f

Browse files
authored
fix: errors during updates and uninstallations when runtime or subprocess is invalid (#787)
1 parent 52805ec commit 292d69f

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/server/AppManager.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,11 @@ export class AppManager {
549549
// the App instance from the source.
550550
const app = await this.getCompiler().toSandBox(this, descriptor, result);
551551

552-
undoSteps.push(() => this.getRuntime().stopRuntime(app.getDenoRuntime()));
552+
undoSteps.push(() =>
553+
this.getRuntime()
554+
.stopRuntime(app.getDenoRuntime())
555+
.catch(() => {}),
556+
);
553557

554558
// Create a user for the app
555559
try {
@@ -639,9 +643,12 @@ export class AppManager {
639643
await this.removeAppUser(app);
640644
await (this.bridges.getPersistenceBridge() as IInternalPersistenceBridge & PersistenceBridge).purge(app.getID());
641645
await this.appMetadataStorage.remove(app.getID());
642-
await this.appSourceStorage.remove(app.getStorageItem()).catch();
646+
await this.appSourceStorage.remove(app.getStorageItem()).catch(() => {});
643647

644-
await this.getRuntime().stopRuntime(app.getDenoRuntime());
648+
// Errors here don't really prevent the process from dying, so we don't really need to do anything on the catch
649+
await this.getRuntime()
650+
.stopRuntime(app.getDenoRuntime())
651+
.catch(() => {});
645652

646653
this.apps.delete(app.getID());
647654
}
@@ -691,7 +698,10 @@ export class AppManager {
691698
descriptor.signature = await this.signatureManager.signApp(descriptor);
692699
const stored = await this.appMetadataStorage.update(descriptor);
693700

694-
await this.getRuntime().stopRuntime(this.apps.get(old.id).getDenoRuntime());
701+
// Errors here don't really prevent the process from dying, so we don't really need to do anything on the catch
702+
await this.getRuntime()
703+
.stopRuntime(this.apps.get(old.id).getDenoRuntime())
704+
.catch(() => {});
695705

696706
const app = await this.getCompiler().toSandBox(this, descriptor, result);
697707

@@ -737,7 +747,10 @@ export class AppManager {
737747
if (appPackageOrInstance instanceof Buffer) {
738748
const parseResult = await this.getParser().unpackageApp(appPackageOrInstance);
739749

740-
await this.getRuntime().stopRuntime(this.apps.get(stored.id).getDenoRuntime());
750+
// Errors here don't really prevent the process from dying, so we don't really need to do anything on the catch
751+
await this.getRuntime()
752+
.stopRuntime(this.apps.get(stored.id).getDenoRuntime())
753+
.catch(() => {});
741754

742755
return this.getCompiler().toSandBox(this, stored, parseResult);
743756
}

0 commit comments

Comments
 (0)