Fix Win32Exception when stopping Elastic Agent service in transient state during test cleanup#348
Draft
Fix Win32Exception when stopping Elastic Agent service in transient state during test cleanup#348
Conversation
…ansient state Co-authored-by: v1v <2871786+v1v@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix test failures related to CI changes
Fix Win32Exception when stopping Elastic Agent service in transient state during test cleanup
Mar 12, 2026
Member
|
buildkite test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clean-ElasticAgentServicecalledStop-Serviceunconditionally, which throwsWin32Exception: The service cannot accept control messages at this timewhen the service is inStartPendingorStopPending. The exception propagated throughClean-ElasticAgent, skippingClean-ElasticAgentProcessandClean-ElasticAgentDirectory, leaving the binary on disk and failing theCheck-AgentRemnantsassertion.Changes
src/agent-qa/helpers.ps1—Clean-ElasticAgentServiceRunningorStopped) before attempting to stop itWrite-Warningif the timeout expires with the service still in a transient stateStop-Service -Forceintry/catchto log stop failures as warnings rather than propagating exceptions that abort the cleanup sequenceStop-Serviceentirely if the service is alreadyStoppedOriginal prompt
This section details on the original issue you should resolve
<issue_title>There are test failures</issue_title>
<issue_description>See https://buildkite.com/elastic/elastic-stack-installers/builds/13650 (changes are not related to the project itself but adding some file to enable some new CI capabilities)
Reproduction
Create a feature branch and its PR.
Then waitn for the CI to run
</issue_description>
<agent_instructions>Review the GH issue description and comments that contain all the ifnormation from the errors that are happening in the CI.
Try to reproduce the error loclaly and find what's causing the problem</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@v1v ```Creating "C:\buildkite-agent\builds\bk-agent-prod-gcp-1773340373614086112\elastic\elastic-stack-installers"
github.com:22 SSH-2.0-a73f77f
choose_kex: unsupported KEX method sntrup761x25519-sha512@openssh.com
github.com:22 SSH-2.0-a73f77f
choose_kex: unsupported KEX method sntrup761x25519-sha512@openssh.com
github.com:22 SSH-2.0-a73f77f
choose_kex: unsupported KEX method sntrup761x25519-sha512@openssh.com
github.com:22 SSH-2.0-a73f77f
choose_kex: unsupported KEX method sntrup761x25519-sha512@openssh.com
github.com:22 SSH-2.0-a73f77f
choose_kex: unsupported KEX method sntrup761x25519-sha512@openssh.com
������ Warning:
ssh-keyscan "github.com"failed (Attempt 1/3 Retrying in 2s)github.com:22 SSH-2.0-a73f77f
choose_kex: unsupported KEX method sntrup761x25519-sha512@openssh.com
github.com:22 SSH-2.0-a73f77f
choose_kex: unsupported KEX method sntrup761x25519-sha512@openssh.com
github.com:22 SSH-2.0-a73f77f
choose_kex: unsupported KEX method sntrup761x25519-sha512@openssh.com
github.com:22 SSH-2.0-a73f77f
choose_kex: unsupported KEX method sntrup761x25519-sha512@openssh.com
github.com:22 SSH-2.0-a73f77f
c...
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.