fix(ecs): forward awslogs before flipping task to STOPPED#752
Merged
vieiralucas merged 1 commit intomainfrom Apr 25, 2026
Merged
fix(ecs): forward awslogs before flipping task to STOPPED#752vieiralucas merged 1 commit intomainfrom
vieiralucas merged 1 commit intomainfrom
Conversation
The runtime was calling finalize_stopped (which writes last_status=STOPPED to ECS state) before forward_awslogs_if_configured (which materialises the log group/stream in fakecloud-logs). A test that polls DescribeTasks until STOPPED and immediately calls DescribeLogStreams could observe STOPPED before the log group existed, flaking ecs_task_awslogs_forwards_to_cloudwatch (and any user code that follows the same pattern). Reorder so log forwarding happens first.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Summary
CI was flaking on
ecs_task_awslogs_forwards_to_cloudwatchbecause the runtime calledfinalize_stopped(writeslast_status=STOPPEDto ECS state) beforeforward_awslogs_if_configured(creates the log group/stream and ingests events into fakecloud-logs).A client polling
DescribeTasksuntil STOPPED and immediately callingDescribeLogStreamscould observe STOPPED before the log group existed, gettingResourceNotFoundException.Reorder so the awslogs forwarding happens first; the STOPPED transition is now the visible signal that "logs are ready."
Test plan
cargo build -p fakecloud-ecscleancargo clippy -p fakecloud-ecs --all-targets -- -D warningscleanecs_task_awslogs_forwards_to_cloudwatchE2E passes in CISummary by cubic
Forward awslogs to CloudWatch before marking ECS tasks as STOPPED to remove a race with clients that query logs right after STOPPED. STOPPED now reliably means the log group/stream exists and logs are ingested.
forward_awslogs_if_configured(...)beforefinalize_stopped(...).ResourceNotFoundExceptionwhen clients pollDescribeTasksuntil STOPPED and immediately callDescribeLogStreams.Written for commit 34b8a3b. Summary will update on new commits.