Race Issue when deploying multiple stacks in parallel
See original GitHub issueI have a loop,
for stack in Stack1 Stack2 Stack3
do
cdk deploy $stack &
end
As written, the first one will sometimes die with this error:
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at new CloudAssembly (/Users/sblackstone/code/lotto/stacks/node_modules/@aws-cdk/cx-api/lib/cloud-assembly.js:25:31)
at CloudAssemblyBuilder.buildAssembly (/Users/sblackstone/code/lotto/stacks/node_modules/@aws-cdk/cx-api/lib/cloud-assembly.js:193:16)
at Function.synth (/Users/sblackstone/code/lotto/stacks/node_modules/@aws-cdk/core/lib/construct.js:72:24)
at App.synth (/Users/sblackstone/code/lotto/stacks/node_modules/@aws-cdk/core/lib/app.js:71:52)
at process.<anonymous> (/Users/sblackstone/code/lotto/stacks/node_modules/@aws-cdk/core/lib/app.js:45:51)
at Object.onceWrapper (events.js:291:20)
at process.emit (events.js:203:13)
Subprocess exited with error 1
Adding a sleep 3
in that loop fixes the problem…
Thanks
Environment
- CLI Version 1.20.0 (build 021c521) :
- OS OSX :
- Language Javascript :
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
CDK Shorts #2 – Parallel Deployments | Rehan van der Merwe
CDK stacks can be deployed in parallel by generating a cloud assembly output and then specifying the order explicitly.
Read more >Prevent parallel execution of the same build definition
The issue at hand is to ensure that a build pipeline runs in sequence and not in parallel if triggered by e.g. multiple...
Read more >Configuring queued, superseded, and parallel runs
Queues form at the entry points to actions and action groups, so you can have multiple queues within the same workflow (see Figure...
Read more >Data Race Patterns in Go | Uber Blog
Higher concurrency also means potential for more concurrency bugs. A data race is a concurrency bug that occurs when two or more goroutines ......
Read more >Advanced Workflows with Parallel steps · Codefresh | Docs
Codefresh allows you insert a parallel phase inside a sequential pipeline with ... If there are race conditions between your parallel steps, (e.g....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
maybe I am missing something, but why not use
cdk deploy Stack*
and let CDK handle ordering/deploying them?resolving this as
cdk deploy '*'
will give you what you need as @richardhboyd mentioned. please reopen if you’re still running into issues here.