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

[stepfunctions-tasks] Complaining "JsiiException: Maximum call stack size exceeded" when building EcsRunTask #9319

Closed
clementy28 opened this issue Jul 29, 2020 · 13 comments · Fixed by #11225
Assignees
Labels
@aws-cdk/aws-stepfunctions-tasks bug This issue is a bug. effort/medium Medium work item – several days of effort in-progress This issue is being actively worked on. p1

Comments

@clementy28
Copy link

Complaining "JsiiException: Maximum call stack size exceeded" when building EcsRunTask

Reproduction Steps

public class DynamoEcsStack extends Stack {
    public static final String CONTAINER_NAME = "DRPDynamoReplicateTableContainer";

    DynamoEcsStack(App app) {
        super(app, "DRPortal-Dynamo-Ecs");

        final Repository repository = Repository.Builder
                .create(this, "Repository")
                .repositoryName("drportal/dynamo/replicate-table")
                .removalPolicy(RemovalPolicy.DESTROY)
                .build();

        final Role executionRole = Role.Builder
                .create(this, "ExecutionRole")
                .assumedBy(new ServicePrincipal("ecs-tasks.amazonaws.com"))
                .managedPolicies(Collections.singletonList(
                        ManagedPolicy.fromAwsManagedPolicyName("service-role/AmazonECSTaskExecutionRolePolicy")))
                .build();

        final Role taskRole = Role.Builder
                .create(this, "TaskRole")
                .assumedBy(new ServicePrincipal("ecs-tasks.amazonaws.com"))
                .managedPolicies(Arrays.asList(
                        ManagedPolicy.fromAwsManagedPolicyName("AmazonKinesisFullAccess"),
                        ManagedPolicy.fromAwsManagedPolicyName("AmazonDynamoDBFullAccess"),
                        ManagedPolicy.fromAwsManagedPolicyName("AWSStepFunctionsFullAccess"),
                        ManagedPolicy.fromAwsManagedPolicyName("CloudWatchFullAccess")))
                .build();

        final Cluster cluster = Cluster.Builder
                .create(this, "ReplicateTableCluster")
                .clusterName("DRPDynamoReplicateTableCluster")
                .build();

        final TaskDefinition taskDefinition = TaskDefinition.Builder
                .create(this, "ReplicateTableTaskDefinition")
                .cpu("2048")
                .memoryMiB("4096")
                .compatibility(Compatibility.FARGATE)
                .executionRole(executionRole)
                .taskRole(taskRole)
                .build();

        final ContainerImage image = ContainerImage.fromEcrRepository(repository, "latest");

        final ContainerDefinition container = taskDefinition
                .addContainer(CONTAINER_NAME, ContainerDefinitionOptions.builder()
                        .image(image)
                        .logging(LogDriver.awsLogs(AwsLogDriverProps.builder()
                                .streamPrefix("dynamo")
                                .logGroup(LogGroup.Builder
                                        .create(this, "DynamoLogGroup")
                                        .logGroupName("/aws/ecs/dynamo/replicateTable")
                                        .retention(RetentionDays.ONE_WEEK)
                                        .removalPolicy(RemovalPolicy.DESTROY)
                                        .build())
                                .build()))
                        .build());

        EcsRunTask.Builder
                .create(this, "ReplicateTable")
                .cluster(cluster)
                .assignPublicIp(true)
                .taskDefinition(taskDefinition)
                .integrationPattern(IntegrationPattern.WAIT_FOR_TASK_TOKEN)
                .containerOverrides(Collections.singletonList(ContainerOverride.builder()
                        .containerDefinition(container)
                        .environment(environment()).build()))
                .launchTarget(EcsFargateLaunchTarget.Builder.create()
                        .platformVersion(FargatePlatformVersion.VERSION1_4).build())
                .build();
    }

    private List<TaskEnvironmentVariable> environment() {
        return Arrays.asList(
                env("source_table", "$[0].source.table"),
                env("source_region", "$[0].source.region"),
                env("target_table", "$[0].target.table"),
                env("target_region", "$[0].target.region"),
                env("credential_access", "$[0].credential.access"),
                env("credential_secret", "$[0].credential.secret"),
                env("task_token", JsonPath.getTaskToken()));
    }

    private TaskEnvironmentVariable env(String name, String value) {
        // TODO wait for TaskEnvironmentVariable.valuePath()
        // HELLO: I NEED THE VALUEPATH HERE DESPERATELY
        return TaskEnvironmentVariable.builder().name(name).value(value).build();
    }
}

Error Log

38f9d3e39f34:hello-cdk clementy$ cdk ls
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project hello-cdk: An exception occured while executing the Java class. Maximum call stack size exceeded
[ERROR] RangeError: Maximum call stack size exceeded
[ERROR]     at Function.entries (<anonymous>)
[ERROR]     at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:78:39)
[ERROR]     at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
[ERROR]     at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
[ERROR]     at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
[ERROR]     at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
[ERROR]     at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
[ERROR]     at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
[ERROR]     at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
[ERROR]     at Kernel._wrapSandboxCode (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:8398:19)
[ERROR]     at Kernel._create (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7922:26)
[ERROR]     at Kernel.create (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7666:21)
[ERROR]     at KernelHost.processRequest (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7446:28)
[ERROR]     at KernelHost.run (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7384:14)
[ERROR]     at Immediate._onImmediate (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7387:37)
[ERROR]     at processImmediate (internal/timers.js:439:21)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project hello-cdk: An exception occured while executing the Java class. Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at Function.entries (<anonymous>)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:78:39)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at Kernel._wrapSandboxCode (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:8398:19)
    at Kernel._create (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7922:26)
    at Kernel.create (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7666:21)
    at KernelHost.processRequest (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7446:28)
    at KernelHost.run (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7384:14)
    at Immediate._onImmediate (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7387:37)
    at processImmediate (internal/timers.js:439:21)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at Function.entries (<anonymous>)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:78:39)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at Kernel._wrapSandboxCode (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:8398:19)
    at Kernel._create (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7922:26)
    at Kernel.create (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7666:21)
    at KernelHost.processRequest (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7446:28)
    at KernelHost.run (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7384:14)
    at Immediate._onImmediate (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7387:37)
    at processImmediate (internal/timers.js:439:21)
    at org.codehaus.mojo.exec.ExecJavaMojo.execute (ExecJavaMojo.java:339)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: software.amazon.jsii.JsiiException: Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at Function.entries (<anonymous>)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:78:39)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at recurseObject (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-kernel-UdfDxD/node_modules/@aws-cdk/aws-stepfunctions/lib/json-path.js:95:24)
    at Kernel._wrapSandboxCode (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:8398:19)
    at Kernel._create (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7922:26)
    at Kernel.create (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7666:21)
    at KernelHost.processRequest (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7446:28)
    at KernelHost.run (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7384:14)
    at Immediate._onImmediate (/private/var/folders/gx/3s8zy0qn0qv6t4r1l_cg64cxzmg53z/T/jsii-java-runtime12286689523936163533/jsii-runtime.js:7387:37)
    at processImmediate (internal/timers.js:439:21)
    at software.amazon.jsii.JsiiRuntime.processErrorResponse (JsiiRuntime.java:119)
    at software.amazon.jsii.JsiiRuntime.requestResponse (JsiiRuntime.java:91)
    at software.amazon.jsii.JsiiClient.createObject (JsiiClient.java:88)
    at software.amazon.jsii.JsiiEngine.createNewObject (JsiiEngine.java:526)
    at software.amazon.awscdk.services.stepfunctions.tasks.EcsRunTask.<init> (EcsRunTask.java:27)
    at software.amazon.awscdk.services.stepfunctions.tasks.EcsRunTask$Builder.build (EcsRunTask.java:298)
    at com.myorg.DynamoEcsStack.<init> (DynamoEcsStack.java:102)
    at com.myorg.HelloCdkApp.main (HelloCdkApp.java:10)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
    at java.lang.Thread.run (Thread.java:834)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Subprocess exited with error 1

Environment

  • CLI Version : 2.0
  • Framework Version: 1.54
  • Node.js Version: v12.13.1
  • OS : Darwin Kernel Version 18.7.0
  • Language (Version): Java 8

Other


This is 🐛 Bug Report

@clementy28 clementy28 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 29, 2020
@clementy28
Copy link
Author

hello-cdk.zip

@shivlaks shivlaks added the p1 label Jul 29, 2020
@shivlaks shivlaks added the effort/medium Medium work item – several days of effort label Aug 20, 2020
@t6nn
Copy link
Contributor

t6nn commented Aug 30, 2020

I ran into a similar problem when defining an ECS task. It seems that when a WAIT_FOR_TASK_TOKEN integration pattern is used, run-task.ts goes to check if a task token reference is present in container overrides, but runs into an infinite recursion through the container definition reference there.

I was able to get this working by implementing a quick monkey-patch on top of json-path's recurseObject to stop on circular references, but I'm hesitant to make it a PR, as I'm not sure if this is the best way to go. Perhaps there's is a better way, e.g. to specify that we only care for environment / command overrides?

@Induator
Copy link

Induator commented Oct 28, 2020

Has there been any updates on this?
I'm facing the same problem with the C# version of CDK. I'm unable to use the IntegrationPattern.WAIT_FOR_TASK_TOKEN and have to resort to some awkward solutions with IntegrationPattern.RUN_JOB which are pretty far from optimal

@t6nn
Copy link
Contributor

t6nn commented Oct 28, 2020

I do have a monkey patch for this that I use myself, but this is unfortunately for npm-based workflows (using patch-package). Haven't had a chance to go through the process of creating a pull request yet to support C# / Java / rest of the tooling options.

@Induator
Copy link

I haven't had a chance to dig into the repo itself. Going to give it a shot myself to try and build the C# package. As far as I understand, C# package uses the ts/js files so I could try to utilize your monkey patch for now.

@t6nn
Copy link
Contributor

t6nn commented Oct 28, 2020

If you try to build the C# package, try using this patch instead on the original repo - this applies to the source, rather than the JS output like the other one. Hopefully this will also fix the C# package out of the box. It was originally written for v1.63.0, but it could work on 1.70 as well, if there haven't been many changes in between.

@shafkevi
Copy link

@t6nn If you can push for this as a PR and get it into the actual codebase for 1.72.0, that would be fantastic.

t6nn added a commit to t6nn/aws-cdk that referenced this issue Oct 30, 2020
…ing encounters a circular object graph

Fixes aws#9319 - stack overflow when EcsRunTask is used with WAIT_FOR_TASK_TOKEN integration pattern.
Implements circular reference detection by keeping a list of visited objects while resolving all referenced JSONPaths.
For the particular issue, a circular reference occurs by ECS container overrides pointing to the container definition,
which in turn has a circular dependency with the task definition.
@SomayaB SomayaB added in-progress This issue is being actively worked on. and removed needs-triage This issue or PR still needs to be triaged. labels Nov 2, 2020
@mergify mergify bot closed this as completed in #11225 Nov 3, 2020
mergify bot pushed a commit that referenced this issue Nov 3, 2020
…encounters a circular object graph (#11225)

This change fixes #9319 where if an EcsRunTask step was used with the WAIT_FOR_TASK_TOKEN integration pattern, the logic for finding all referenced JSONPath elements in container overrides would encounter a circular reference and terminate with a stack overflow. 

With this change, `JsonPath.recurseObject` and `JsonPath.recurseArray` would maintain a list of already visited objects and use it to prune circular references back to an already visited object.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Nov 3, 2020

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@oappicgi
Copy link

Still having this issue when using cdk 1.92.00 (typescript) and since this is approaching 1 year mark of being show stopper for using fargate in step functions in meaningful way (as i would imagine signaling back for success after task is done is somewhat important feature for step function logic) even "monkey-patch" is better than nothing.

@shafkevi
Copy link

@oappicgi I have been having success using Fargate step functions with WAIT_FOR_TASK_TOKEN and also with the RUN_JOB integration in this repo. This repo is using 1.91 (typescript) cdk.

@oappicgi
Copy link

oappicgi commented Mar 10, 2021

that is slightly odd, your repo uses custom construct, but to my understanding it still uses the same EcsRunTask i am using, but I am still getting "Maximum call stack size exceeded".
With out
integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE,
line it works perfectly, i just have to manually replace resource field

@shafkevi
Copy link

Hmm, interesting. I would double check to make sure in your package-lock.json file that all the dependency versions match up to what your intended versions are. I know that can sometimes be a sneaky way for bugs to appear...

@oappicgi
Copy link

doh!
yea, that was the issue. I am fairly sure I did npm update, but apparently packages were still at 1.66, thanks shafkevi ! so yea this has been fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-stepfunctions-tasks bug This issue is a bug. effort/medium Medium work item – several days of effort in-progress This issue is being actively worked on. p1
Projects
None yet
7 participants