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

auto: Fix inline programs timing out in CI #1646

Merged
merged 3 commits into from
Feb 7, 2025
Merged

Conversation

justinvp
Copy link
Member

@justinvp justinvp commented Feb 7, 2025

Fixes #1641

Three commits:

1. Don't block thread pool threads

Don't tie up shared thread pool threads blocked on reading stdout/stderr when running commands, which can lead to deadlocks running inline programs when no thread pool threads are available to make forward progress.

Similarly, when reading the event log, we can use a single thread as to not block a shared thread pool thread.

We also don't need to write stdin using a thread.

2. Don't block in the gRPC language server's run method

Instead of blocking, we can complete the request by calling onNext and onCompleted asynchronously from a continuation after running the inline program.

3. Unskip testStackLifecycleInlineProgram test

Also reduce the timeout to 1 minute in both lifecycle tests.

Don't tie up shared threadpool threads blocked on reading stdout/stderr
when running commands, which can lead to deadlocks running inline
programs when no thread pool threads are available to make forward
progress.

Similarly, when reading the event log, we can use a single thread as to
not block a shared threadpool thread.

We also don't need to write stdin using a thread.
Instead of blocking, we can complete the request by calling `onNext` and
`onCompleted` asynchronously from a continuation after running the
inline program.
Also reduce the timeout to 1 minute in both lifecycle tests.
@justinvp justinvp added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Feb 7, 2025
@justinvp justinvp requested a review from a team as a code owner February 7, 2025 16:42
@justinvp justinvp merged commit d53b4f9 into main Feb 7, 2025
23 checks passed
@justinvp justinvp deleted the justin/auto_inline branch February 7, 2025 17:08
semaphore.release();
}
});
} catch (Exception e) {

Choose a reason for hiding this comment

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

Is there a reason why this is not just a finally, removing the need for the nested try/finally?

Copy link
Member Author

Choose a reason for hiding this comment

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

If it was a finally here, I think it'll be called too soon, because runAsync(program).handle(...) is async, and will return immediately. I want to release the lock after the inline program is finished running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

auto: Inline program lifecycle tests are timing out in CI
3 participants