Skip to content

Commit

Permalink
fix #871
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Jan 22, 2025
1 parent 2da75a8 commit c5b84d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@ async function getStats() {
const vBrowserLaunches = await getRedisCountDay('vBrowserLaunches');
const vBrowserFails = await getRedisCountDay('vBrowserFails');
const vBrowserStagingFails = await getRedisCountDay('vBrowserStagingFails');
const vBrowserReimages = await getRedisCountDay('vBrowserReimage');
const vBrowserStopTimeout = await getRedisCountDay(
'vBrowserTerminateTimeout',
);
Expand Down Expand Up @@ -1008,6 +1009,7 @@ async function getStats() {
vBrowserLaunches,
vBrowserFails,
vBrowserStagingFails,
vBrowserReimages,
vBrowserStopManual,
vBrowserStopEmpty,
vBrowserStopTimeout,
Expand Down
6 changes: 4 additions & 2 deletions server/vm/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export abstract class VMManager {
// Check if VM needs to be reimaged
if (this.imageId !== vmImageId) {
await this.reimageVM(vmid);
redisCount('vBrowserReimage');
// Update the vmImageId
await postgres.query(
`UPDATE vbrowser SET image = $3 WHERE pool = $1 AND vmid = $2`,
Expand Down Expand Up @@ -472,9 +473,10 @@ export abstract class VMManager {
redisCount('vBrowserStagingFails');
await redis?.lpush('vBrowserStageFails', vmid);
await redis?.ltrim('vBrowserStageFails', 0, 24);
// VM didn't come up. Try reimaging
await this.reimageVM(vmid);
redisCount('vBrowserReimage');
await this.resetVM(vmid);
// TODO if we fail this too many times we should probably reimage it
// await this.terminateVMWrapper(vmid);
}
if (retryCount >= 180) {
throw new Error('too many attempts on vm ' + vmid);
Expand Down
2 changes: 2 additions & 0 deletions server/vm/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export class Docker extends VMManager {
`docker pull ${this.imageId}`,
);
console.log(stdout, stderr);
// The container is out of date. Delete it
this.terminateVMWrapper(id);
return;
};

Expand Down

0 comments on commit c5b84d1

Please sign in to comment.