Skip to content
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

[BE-170] Detect if there is no output and abort Step #801

Merged
merged 20 commits into from
Aug 1, 2022

Conversation

lpusok
Copy link
Contributor

@lpusok lpusok commented Jul 26, 2022

The env BITRISE_NO_OUTPUT_TIMEOUT can be used to set a timeout in seconds, after which if there is no output from the current Step then it is aborted. The option is disabled by default.

I plant to add in following PRs:

  • Option to configure timeout on a per-step level.
  • Extend analytics.
  • Collect more debug info from hanged process.

Solves: https://bitrise.atlassian.net/browse/BE-170

@lpusok lpusok force-pushed the BE-83-detect-hangs branch from fe13255 to a07f884 Compare July 27, 2022 09:45
@lpusok lpusok force-pushed the BE-83-detect-hangs branch from 2db8c39 to 6beebe9 Compare July 27, 2022 16:22
@lpusok lpusok force-pushed the BE-83-detect-hangs branch from ac0f703 to d49743f Compare July 29, 2022 11:38
@lpusok lpusok changed the title Initial proof-of-concept Detect if there is no output and abort Step Jul 29, 2022
@lpusok lpusok marked this pull request as ready for review July 29, 2022 15:37
@lpusok lpusok mentioned this pull request Jul 29, 2022
@lpusok lpusok requested a review from ofalvai July 29, 2022 16:09
@lpusok lpusok force-pushed the BE-83-detect-hangs branch from d4cb289 to 61d1252 Compare August 1, 2022 06:27
}

func readNoOutputTimoutConfiguration(inventoryEnvironments []envmanModels.EnvironmentItemModel) time.Duration {
const defaultTimeout = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be a bit safer to use -1 as the off value here instead of 0. A zero duration is something that other parts of the codebase can still interpret as a timeout and activate the hang detector accidentally.

c.timeout = timeout
}

// SetHangTimeout sets the timeout after which the command is killed when no output is received.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no output is received on either stdout or stderr.


// SetHangTimeout sets the timeout after which the command is killed when no output is received.
func (c *Command) SetHangTimeout(timeout time.Duration) {
c.hangTimeout = timeout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be inside the if too?

outWriter io.Writer
}

func tickerSettings(timeout time.Duration) (interval time.Duration, tickLimit uint64) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this private function should go below the public ones in this file

@lpusok lpusok changed the title Detect if there is no output and abort Step [BE-170] Detect if there is no output and abort Step Aug 1, 2022
@lpusok lpusok merged commit ad7f832 into master Aug 1, 2022
@lpusok lpusok deleted the BE-83-detect-hangs branch August 1, 2022 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants