(aws-ecs): `shouldUseCircuitBreaker` warning is emitted for DAEMON scheduling-strategy services, where the deployment circuit breaker doesn't apply
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
The `@aws-cdk/aws-ecs:shouldUseCircuitBreaker` warning ("Enable the 'circuitBreaker' property to trigger a quicker deployment failure...") is emitted for an `Ec2Service` created with `daemon: true` (DAEMON scheduling strategy).
The ECS deployment circuit breaker is not applicable to daemon services: its failure threshold is defined as `0.5 × desiredCount` (min 3, max 200), and a daemon service has no desired count (it runs one task per instance). The circuit breaker is documented for rolling-update **replica** services. So this warning is a false positive — following its advice (setting `circuitBreaker`) is meaningless for a daemon service, and the only way to make it go away is to `acknowledgeWarning(...)` advice that doesn't apply.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Library Version
_No response_
### Expected Behavior
No `shouldUseCircuitBreaker` warning is emitted for services using the DAEMON scheduling strategy.
### Current Behavior
The warning is emitted on synth for daemon services:
```
[Warning at /Stack/DaemonService] Enable the 'circuitBreaker' property to trigger a quicker deployment failure if tasks are failing to come start (without this setting deployments may take up to 3 hours to fail). [ack: @aws-cdk/aws-ecs:shouldUseCircuitBreaker]
```
### Reproduction Steps
```ts
const vpc = new ec2.Vpc(this, 'Vpc');
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
cluster.addCapacity('Cap', { instanceType: new ec2.InstanceType('t3.micro') });
const taskDef = new ecs.Ec2TaskDefinition(this, 'TaskDef');
taskDef.addContainer('c', {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
memoryReservationMiB: 128,
});
new ecs.Ec2Service(this, 'DaemonService', {
cluster,
taskDefinition: taskDef,
daemon: true, // DAEMON scheduling strategy
// no circuitBreaker -> warning is emitted even though it cannot apply
});
```
Run `cdk synth` and observe the warning on `DaemonService`.
### Possible Solution
The warning is emitted in `BaseService` (`aws-ecs/lib/base/base-service.ts`), guarded only by `!props.circuitBreaker && this.isEcsDeploymentController` — with no checkfor the scheduling strategy. The `daemon`/scheduling-strategy information is only set in the `Ec2Service` subclass, so `BaseService` never accounts for it.
Suggested fix: suppress `shouldUseCircuitBreaker` when the service uses the DAEMON scheduling strategy. CDK already special-cases daemon services elsewhere (it validates`desiredCount`, placement strategies, and AZ-rebalancing against daemon mode, and has a dedicated `@aws-cdk/aws-ecs:minHealthyPercentDaemon` warning — #31705), so thisis an inconsistency rather than intended behaviour. Related signal-vs-noise precedent for an unsuppressable circuit-breaker-adjacent warning: #10059.
The circuit breaker requires the ECS (rolling-update) deployment controller, which daemon services do use — so `isEcsDeploymentController` is true and the warning fires — but the breaker itself is desired-count based and isn't meaningful for daemon scheduling.
### Additional Information/Context
_No response_
### AWS CDK Library version (aws-cdk-lib)
"aws-cdk-lib": "2.258.0"
### AWS CDK CLI version
"aws-cdk": "2.1126.0"
### Node.js Version
v26.2.0
### OS
Windows 10
### Language
TypeScript
### Language Version
Typescript 5.8.3
### Other information
_No response_
Contributor guide
Research direction
Start in aws-ecs/lib/base/base-service.ts, then trace how the daemon/scheduling-strategy information is set in the Ec2Service subclass. Run the provided TypeScript reproduction with cdk synth and verify that shouldUseCircuitBreaker is not emitted for DAEMON services while the warning remains applicable to replica services.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100