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

CfnAssociation_ throws 'Collection was modified' #3290

Closed
1 of 5 tasks
kuhnboy opened this issue Jul 11, 2019 · 2 comments
Closed
1 of 5 tasks

CfnAssociation_ throws 'Collection was modified' #3290

kuhnboy opened this issue Jul 11, 2019 · 2 comments
Labels
needs-triage This issue or PR still needs to be triaged.

Comments

@kuhnboy
Copy link

kuhnboy commented Jul 11, 2019

Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository's issues are intended for feature requests and bug reports.

  • I'm submitting a ...

    • 🪲 bug report
    • 🚀 feature request
    • 📚 construct library gap
    • ☎️ security issue or vulnerability => Please see policy
    • ❓ support request => Please see note at the top of this template.
  • What is the current behavior?
    If the current behavior is a 🪲bug🪲: Please provide the steps to reproduce

Creating CfnAssociation throws on synth:

Unhandled Exception: Amazon.JSII.Runtime.JsiiException: Amazon.JSII.Runtime.JsiiException: Resolution error: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

new CfnAssociation_(this, "patchScan", new CfnAssociationProps
{
AssociationName = $"abc-patch-scan",
Targets = new[]
{
new Amazon.CDK.AWS.SSM.CfnAssociation.TargetProperty
{
Key = "tag:Patch Group",
Values = new[]
{
$"abc-az1",
$"abc-az2",
$"abc-az3"
}
}
},
DocumentVersion = "$LATEST",
Name = "AWS-RunPatchBaseline",
OutputLocation = new Amazon.CDK.AWS.SSM.CfnAssociation.InstanceAssociationOutputLocationProperty
{
S3Location = new Amazon.CDK.AWS.SSM.CfnAssociation.S3OutputLocationProperty
{ OutputS3BucketName = $"ssm-bucket", OutputS3KeyPrefix = $"prefix/patch-scan" }
},
Parameters = new Dictionary<string, Amazon.CDK.AWS.SSM.CfnAssociation.ParameterValuesProperty>
{
{
"Operation", new Amazon.CDK.AWS.SSM.CfnAssociation.ParameterValuesProperty
{
ParameterValues = new[] { "Scan" }
}
}
}
});

  • What is the expected behavior (or behavior of feature suggested)?

Synth creates cdk.out. Trying to test: #3092

  • What is the motivation / use case for changing the behavior or adding this feature?

  • Please tell us about your environment:

    • CDK CLI Version: 1.0.0
    • Module Version: 1.0.0-devpreview
    • OS: Windows 10
    • Language: C#
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)

Unhandled Exception: Amazon.JSII.Runtime.JsiiException: Amazon.JSII.Runtime.JsiiException: Resolution error: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.Dictionary2.KeyCollection.Enumerator.MoveNext() at Amazon.JSII.Runtime.CallbackExtensions.FromKernel(Object obj, IReferenceMap referenceMap) at Amazon.JSII.Runtime.CallbackExtensions.FromKernel(Object obj, IReferenceMap referenceMap) at System.Linq.Enumerable.SelectArrayIterator2.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at Amazon.JSII.Runtime.CallbackExtensions.InvokeMethod(InvokeRequest request, IReferenceMap referenceMap) at Amazon.JSII.Runtime.CallbackExtensions.InvokeCallback(Callback callback, IReferenceMap referenceMap, IFrameworkToJsiiConverter converter, String& error). Object creation stack: at new Intrinsic (C:\Users\rkuhn\AppData\Local\Temp\jsii-kernel-Mqbj2n\node_modules\@aws-cdk\core\lib\private\intrinsic.js:20:44) at new PostResolveToken (C:\Users\rkuhn\AppData\Local\Temp\jsii-kernel-Mqbj2n\node_modules\@aws-cdk\core\lib\util.js:72:9) at CfnAssociation._toCloudFormation (C:\Users\rkuhn\AppData\Local\Temp\jsii-kernel-Mqbj2n\node_modules\@aws-cdk\core\lib\cfn-resource.js:167:39) at node.addReference.resolve_1.findTokens (C:\Users\rkuhn\AppData\Local\Temp\jsii-kernel-Mqbj2n\node_modules\@aws-cdk\core\lib\cfn-element.js:84:77) at Object.findTokens (C:\Users\rkuhn\AppData\Local\Temp\jsii-kernel-Mqbj2n\node_modules\@aws-cdk\core\lib\private\resolve.js:125:13) at CfnAssociation.prepare (C:\Users\rkuhn\AppData\Local\Temp\jsii-kernel-Mqbj2n\node_modules\@aws-cdk\core\lib\cfn-element.js:84:49) at _wrapSandboxCode (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6493:51) at Kernel._wrapSandboxCode (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:7126:20) at ret._ensureSync (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6493:25) at Kernel._ensureSync (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:7097:20) at Kernel.invoke (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6492:26) at KernelHost.processRequest (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6186:28) at completeCallback (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6159:25) at KernelHost.callbackHandler (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6140:16) at KernelHost.kernel.jsii_kernel_1.Kernel.cb [as callbackHandler] (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6124:59) at CfnAssociation.value (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6843:41) at Function.prepare (C:\Users\rkuhn\AppData\Local\Temp\jsii-kernel-Mqbj2n\node_modules\@aws-cdk\core\lib\construct.js:89:27) at Function.synth (C:\Users\rkuhn\AppData\Local\Temp\jsii-kernel-Mqbj2n\node_modules\@aws-cdk\core\lib\construct.js:52:14) at App.synth (C:\Users\rkuhn\AppData\Local\Temp\jsii-kernel-Mqbj2n\node_modules\@aws-cdk\core\lib\app.js:67:52) at _wrapSandboxCode (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6493:51) at Kernel._wrapSandboxCode (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:7126:20) at ret._ensureSync (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6493:25) at Kernel._ensureSync (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:7097:20) at Kernel.invoke (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6492:26) at KernelHost.processRequest (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6186:28) at KernelHost.run (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6132:14) at processRequest (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6132:45) at KernelHost.processRequest (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6228:16) at KernelHost.run (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6132:14) at processRequest (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6132:45) at KernelHost.processRequest (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6228:16) at KernelHost.run (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6132:14) at processRequest (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6132:45) at promise.then.val (C:\Users\rkuhn\AppData\Local\Temp\cxjwsqod.kzz\jsii-runtime.js:6213:21) at <anonymous> at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson) at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]() at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson) at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]() at Amazon.JSII.Runtime.Deputy.DeputyBase.<InvokeMethodCore>g__GetResult|18_0[T](<>c__DisplayClass18_01& )
at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeMethodCore[T](JsiiMethodAttribute methodAttribute, Object[] arguments, Func3 beginFunc, Func3 invokeFunc)
at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeInstanceMethod[T](Object[] arguments, String methodName)
at Amazon.CDK.CfnElement.Prepare()
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponseTResponse
at Amazon.JSII.Runtime.Services.Client.TryDeserialize[TResponse](String responseJson)
at Amazon.JSII.Runtime.Services.Client.ReceiveResponseTResponse
at Amazon.JSII.Runtime.Deputy.DeputyBase.g__GetResult|18_0[T](<>c__DisplayClass18_01& ) at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeMethodCore[T](JsiiMethodAttribute methodAttribute, Object[] arguments, Func3 beginFunc, Func`3 invokeFunc)
at Amazon.JSII.Runtime.Deputy.DeputyBase.InvokeInstanceMethod[T](Object[] arguments, String methodName)
at HelloCdk.Program.Main(String[] args) in C:\source\foo\src\HelloCdk\Program.cs:line 19
Subprocess exited with error 3762504530

@kuhnboy kuhnboy added the needs-triage This issue or PR still needs to be triaged. label Jul 11, 2019
@kuhnboy
Copy link
Author

kuhnboy commented Jul 11, 2019

Possibly related to: https://github.com/aws/aws-cdk/issues/3280

@RomainMuller
Copy link
Contributor

This should have been fixed by now. Please re-open if still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants