Skip to content

Report app lock errors correctly#12225

Merged
swiatekm merged 1 commit intomainfrom
fix/app-lock-error
Jan 13, 2026
Merged

Report app lock errors correctly#12225
swiatekm merged 1 commit intomainfrom
fix/app-lock-error

Conversation

@swiatekm
Copy link
Contributor

@swiatekm swiatekm 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>)
If we failed to get the app lock, we wouldn't emit the underlying error.
@swiatekm swiatekm added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-active-all Automated backport with mergify to all the active branches labels Jan 13, 2026
@swiatekm swiatekm marked this pull request as ready for review January 13, 2026 11:02
@swiatekm swiatekm requested a review from a team as a code owner January 13, 2026 11:02
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

cc @swiatekm

@swiatekm swiatekm merged commit a44ff92 into main Jan 13, 2026
29 checks passed
@swiatekm swiatekm deleted the fix/app-lock-error branch January 13, 2026 17:14
@github-actions
Copy link
Contributor

@Mergifyio backport 8.19 9.1 9.2 9.3

@mergify
Copy link
Contributor

mergify bot commented Jan 13, 2026

backport 8.19 9.1 9.2 9.3

✅ Backports have been created

Details
mergify bot pushed a commit that referenced this pull request Jan 13, 2026
If we failed to get the app lock, we wouldn't emit the underlying error.

(cherry picked from commit a44ff92)
mergify bot pushed a commit that referenced this pull request Jan 13, 2026
If we failed to get the app lock, we wouldn't emit the underlying error.

(cherry picked from commit a44ff92)
mergify bot pushed a commit that referenced this pull request Jan 13, 2026
If we failed to get the app lock, we wouldn't emit the underlying error.

(cherry picked from commit a44ff92)
mergify bot pushed a commit that referenced this pull request Jan 13, 2026
If we failed to get the app lock, we wouldn't emit the underlying error.

(cherry picked from commit a44ff92)
swiatekm added a commit that referenced this pull request Jan 14, 2026
If we failed to get the app lock, we wouldn't emit the underlying error.
swiatekm added a commit that referenced this pull request Jan 15, 2026
If we failed to get the app lock, we wouldn't emit the underlying error.

(cherry picked from commit a44ff92)

Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com>
swiatekm added a commit that referenced this pull request Jan 16, 2026
* Report app lock errors correctly (#12225)

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

(cherry picked from commit a44ff92)

* Bump versions

---------

Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com>
swiatekm added a commit that referenced this pull request Jan 20, 2026
If we failed to get the app lock, we wouldn't emit the underlying error.

(cherry picked from commit a44ff92)
swiatekm added a commit that referenced this pull request Jan 20, 2026
* Report app lock errors correctly (#12225)

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

(cherry picked from commit a44ff92)

* Fix linter warning

---------

Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

3 participants