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

Exit code 2 when Cloudwatch agent is almost immediately stopped #770

Open
SamStephens opened this issue Jun 20, 2023 · 6 comments
Open

Exit code 2 when Cloudwatch agent is almost immediately stopped #770

SamStephens opened this issue Jun 20, 2023 · 6 comments

Comments

@SamStephens
Copy link

Describe the bug

I'm using Cloudwatch Agent as an ECS sidecar. I have a scenario where I spin up an ECS instance, and it almost immediately spins down doing no work and with no metrics emitted to the Cloudwatch Agent.

What I'm seeing is that when this happens, the Cloudwatch Agent Logstream is empty, and the Cloudwatch Agent container exits with Exit Code 2, causing my ECS task to be considered to have failed.

Steps to reproduce

Spin up an ECS instance with the Cloudwatch Agent as an ECS sidecar, and code that exits immediately with no metrics emitted to the Cloudwatch Agent.

What did you expect to see?

Cloudwatch Agent exit with exit code 0. Some logs indicating what the Agent has done.

What did you see instead?

Cloudwatch Agent exit with exit code 2. No logs indicating what the Agent has done.

What version did you use?

The current version from https://hub.docker.com/r/amazon/cloudwatch-agent, which appears to be 1.247359.1b252618.

What config did you use?

Config: {
"logs": {
"metrics_collected": {
"emf": {},
}
}
}

Environment

ECS sidecar

Additional context

NA

@github-actions
Copy link
Contributor

This issue was marked stale due to lack of activity.

@github-actions github-actions bot added the Stale label Sep 23, 2023
@SamStephens
Copy link
Author

Still relevant.

@github-actions github-actions bot removed the Stale label Sep 24, 2023
@sethAmazon
Copy link
Contributor

Thank you for reporting the issue

Are you saying you have a container (your app) and a side car (cloudwatch agent)?
Then, when you start the task, the app shuts down immediately, causing the cwa to exit before sending metrics to cw?

@SamStephens
Copy link
Author

SamStephens commented Oct 5, 2023

Are you saying you have a container (your app) and a side car (cloudwatch agent)?
Then, when you start the task, the app shuts down immediately, causing the cwa to exit before sending metrics to cw?

@sethAmazon Correct, except that no metrics are reported to CWA, so the CWA does not exit before sending the metrics.

The problem isn't the lack of metrics emission - there's none to emit. The problem is that the sidecar exits with exit code 2 and causes my ECS task to be considered to be failed (this is running as part of a step function).

Copy link
Contributor

This issue was marked stale due to lack of activity.

@github-actions github-actions bot added the Stale label Aug 18, 2024
@SamStephens
Copy link
Author

@sethAmazon does anyone still work at AWS?

@github-actions github-actions bot removed the Stale label Aug 25, 2024
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

No branches or pull requests

2 participants