Skip to content

Extending workspace timeouts fails when workspaces are running in multiple regions #9174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #9072
andrew-farries opened this issue Apr 7, 2022 · 2 comments · Fixed by #9427
Closed
Tracked by #9072
Assignees
Labels
component: server size/XS team: webapp Issue belongs to the WebApp team type: bug Something isn't working

Comments

@andrew-farries
Copy link
Contributor

Bug description

If I have workspaces running in multiple regions (eg one in the US and one in the EU), an attempt to extend the workspace timeout in either workspace will fail.

Steps to reproduce

  • Create a workspace in the US region
  • Create a workspace in the EU region
  • Attempt to extend the workspace timeout in the EU workspace

The attempt to extend the timeout fails with an error like:

image

Workspace affected

No response

Expected behavior

It should be possible to extend a workspace timeout regardless of which region my other workspaces are running in.

Example repository

No response

Anything else?

No response

@andrew-farries andrew-farries added component: server team: webapp Issue belongs to the WebApp team labels Apr 7, 2022
@andrew-farries
Copy link
Contributor Author

The cause is here:

// if any other running instance has a custom timeout other than the user's default, we'll reset that timeout
const client = await this.workspaceManagerClientProvider.get(runningInstance.region);
const defaultTimeout = await this.userService.getDefaultWorkspaceTimeout(user);
const instancesWithReset = runningInstances.filter(
(i) => i.workspaceId !== workspaceId && i.status.timeout !== defaultTimeout && i.status.phase === "running",
);
await Promise.all(
instancesWithReset.map((i) => {
const req = new SetTimeoutRequest();
req.setId(i.id);
req.setDuration(this.userService.workspaceTimeoutToDuration(defaultTimeout));
return client.setTimeout(ctx, req);
}),
);
const req = new SetTimeoutRequest();
req.setId(runningInstance.id);
req.setDuration(this.userService.workspaceTimeoutToDuration(duration));
await client.setTimeout(ctx, req);

When extending the workspace timeout, we also attempt to extend the timeout in all other running workspaces (why?), but we do so with the wrong client - we reuse the one for the region of the workspace where we requested the extension.

@geropl geropl added the type: bug Something isn't working label Apr 7, 2022
@geropl geropl moved this to Scheduled in 🍎 WebApp Team Apr 7, 2022
@geropl
Copy link
Member

geropl commented Apr 7, 2022

Thanks for investigating @andrew-farries ! 💪 Moved to scheduled. 📓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: server size/XS team: webapp Issue belongs to the WebApp team type: bug Something isn't working
Projects
Archived in project
2 participants