Skip to content

[8.19] (backport #12225) Report app lock errors correctly#12230

Merged
swiatekm merged 3 commits into8.19from
mergify/bp/8.19/pr-12225
Jan 20, 2026
Merged

[8.19] (backport #12225) Report app lock errors correctly#12230
swiatekm merged 3 commits into8.19from
mergify/bp/8.19/pr-12225

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jan 13, 2026

What does this PR do?

Ensures we emit the underlying error if we fail to acquire the app lock. Before, we'd erroneously just put nil in there.

Why is it important?

We should always report the underlying error, as it helps with troubleshooting.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • [ ] I have added an integration test or an E2E test

How to test this PR locally

Run two agents concurrently from the same data directory. You should get:

Error: failed to get app lock: another elastic-agent is already running

Before this change, it's:

Error: failed to get app lock: %!w(<nil>)

This is an automatic backport of pull request #12225 done by [Mergify](https://mergify.com).
@mergify mergify bot requested a review from a team as a code owner January 13, 2026 17:16
@mergify mergify bot requested review from michel-laterman and swiatekm and removed request for a team January 13, 2026 17:16
@mergify mergify bot added the backport label Jan 13, 2026
@github-actions github-actions bot added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team labels Jan 13, 2026
@mergify mergify bot mentioned this pull request Jan 13, 2026
3 tasks
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

swiatekm
swiatekm previously approved these changes Jan 14, 2026
@swiatekm swiatekm enabled auto-merge (squash) January 14, 2026 15:55
@mergify
Copy link
Contributor Author

mergify bot commented Jan 19, 2026

This pull request has not been merged yet. Could you please review and merge it @swiatekm? 🙏

If we failed to get the app lock, we wouldn't emit the underlying error.

(cherry picked from commit a44ff92)
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

History

cc @swiatekm

@swiatekm swiatekm merged commit 21dc141 into 8.19 Jan 20, 2026
22 checks passed
@swiatekm swiatekm deleted the mergify/bp/8.19/pr-12225 branch January 20, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

2 participants