Skip to content

gp timeout set allows >24 hour timeout (and < 1s) #16085

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
loujaybee opened this issue Jan 30, 2023 · 11 comments
Closed

gp timeout set allows >24 hour timeout (and < 1s) #16085

loujaybee opened this issue Jan 30, 2023 · 11 comments

Comments

@loujaybee
Copy link
Member

loujaybee commented Jan 30, 2023

The docs for gp timeout set [1] states that the workspace timeout cannot be set to exceed 24 hours "maximum workspace timeout is 24 hours", however current gp timeout set allows for higher values than 24 hours to be entered.

  • Expected result: gp timeout set returns an error message if value is set higher than 24hours
  • Actual result: gp timeout set allows to set an above 24 hours value without error.

We should also set a sane upper and lower default: e.g. somewhere between 3 days to 1 week (requires discussion) which could potentially be overridden by contacting Gitpod directly, or in certain circumstances, however the current command allows you to set values into the 100's of years + (e.g. gp timeout set 2000000h => success, which is 228 years). Also the current command allows you to set very low timeouts, e.g. < 1 minute, which can be done in error.

Setting timeout to 25 hours The current documentation
image image
@loujaybee loujaybee changed the title gp timeout set allows >24 hour timeout gp timeout set allows >24 hour timeout (and < 1s) Jan 30, 2023
@atduarte
Copy link
Contributor

Just want to add that the total time of a workspace session (i.e. instance) currently is defined at 24 hours. Meaning that if the workspace ran for 2 hours, a 24h timeout should not be possible.

@Siddhant-K-code
Copy link
Member

Siddhant-K-code commented Jan 30, 2023

quick-go (before this month's changelog release): We could add the limit b/w 5m (current: 1m) & 1440m (24 hours). Else, it would return an error.

Future: We could decouple the server limit & adding support to this (#9038 (comment)) & allow users to set to >1440m

@loujaybee
Copy link
Member Author

@atduarte is there anyway for a user to know how long is remaining? Or, when the workspace was created to get an understanding for how long is remaining on the timeout? I would like to update this documentation PR.

@Siddhant-K-code
Copy link
Member

quick-go (before this month's changelog release): We could add the limit b/w 5m (current: 1m) & 1440m (24 hours). Else, it would return an error.

@loujaybee @atduarte Should I send out a small PR to limit this from Gitpod CLI side? to avoid misuse (before changelog release)

@loujaybee
Copy link
Member Author

loujaybee commented Feb 9, 2023

Should I send out a small PR to limit this from Gitpod CLI side? - @Siddhant-K-code

Yes, please. We are adding this constraint to the other clients, also:

@filiptronicek
Copy link
Member

@loujaybee cc @Siddhant-K-code the JetBrains PR, #16267, should fix these issues and add the 24 hour hard limit:
image

@Siddhant-K-code
Copy link
Member

Siddhant-K-code commented Feb 9, 2023

Suggestion: With an Invalid message, can we specify the next action item to the user?

Invalid timeout value: 0m. Timeout limit should be between 5m to 24h

@filiptronicek
Copy link
Member

Invalid timeout value: 0m. Timeout limit should be between 5m to 24h

Looks good, I think that can be helpful.

Do we have ideas for a sensible minimum workspace timeout? Currently, it's 1 minute. Maybe no need to change that, although extremely low.

@filiptronicek
Copy link
Member

filiptronicek commented Feb 9, 2023

Updated the CLI command with the maximum boundary: e7427bd (#16267)

gitpod /workspace/gitpod/components/gitpod-cli (filiptronicek/jetbrains-plugin-16107) $ go run . timeout set -h
Set timeout of current workspace.

Duration must be in the format of <n>m (minutes), <n>h (hours) and cannot be longer than 24 hours.
For example, 30m, 1h, 5h, etc.

Usage:
  gp timeout set <duration> [flags]

Examples:
gitpod timeout set 1h

Flags:
  -h, --help   help for set

@Siddhant-K-code
Copy link
Member

Do we have ideas for a sensible minimum workspace timeout

@loujaybee or @atduarte might have some thoughts as they are also involved with this similar PR for docs (https://github.com/gitpod-io/website/pull/3341#discussion_r1101312402)

image

@loujaybee
Copy link
Member Author

Will close this issue as it's now partially completed. The command no longer allows more than 24hour timeouts, however the error output exposes unneeded implementation details around grpc:

gitpod /workspace/empty (main) $ gp timeout set 25h
jsonrpc2: code 650 message: Invalid duration : Workspace inactivity timeout cannot exceed 24h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants