prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  bug: Long Running Lambda Fails StepFunction State Machine Execution
  ### Is there an existing issue for this?
  
  - [X] I have searched the existing issues
  
  ### Current Behavior
  
  As of `v3.0.0` and `v3.0.1`, StepFunction StateMachines that have long-running Lambda tasks fail execution. It also looks like the StateMachine then retries by re-invoking the lambda 3 times in the background with a 1 minute gap in between invocations. Unfortunately, the state machine will have already failed execution by this point and these lambda runs fail when they try to update the state.
  
  The lambda is started successfully, but then fails with a timeout after 3 seconds:
  
  ```
  2023-11-24T22:09:56.758 ERROR --- [ad-35 (eval)] l.s.s.a.c.eval_component   : Exception=FailureEventException, Error=Exception, Details={"taskFailedEventDetails": {"error": "Exception", "cause": "{\"errorMessage\":\"2023-11-24T22:09:56Z dbd4767f-32b8-46b7-9ef4-382ee583ad0a Task timed out after 3.00 seconds\"}", "resource": "invoke", "resourceType": "lambda"}} at '(StateTaskServiceLambda| {'comment': None, 'input_path': (InputPath| {'input_path_src': '$'}, 'output_path': (OutputPath| {'output_path': '$'}, 'state_entered_event_type': 'TaskStateEntered', 'state_exited_event_type': 'TaskStateExited', 'result_path': None, 'result_selector': None, 'retry': (RetryDecl| {'retriers': [(RetrierDecl| {'error_equals': (ErrorEqualsDecl| {'error_names': [(CustomErrorName| {'error_name': 'Lambda.ClientExecutionTimeoutException'}, (CustomErrorName| {'error_name': 'Lambda.ServiceException'}, (CustomErrorName| {'error_name': 'Lambda.AWSLambdaException'}, (CustomErrorName| {'error_name': 'Lambda.SdkClientException'}]}, 'interval_seconds': (IntervalSecondsDecl| {'seconds': 2}, 'max_attempts': (MaxAttemptsDecl| {'attempts': 6}, 'backoff_rate': (BackoffRateDecl| {'rate': 2.0}, '_attempts_counter': 0, '_next_interval_seconds': 2}]}, 'catch': None, 'timeout': (TimeoutSeconds| {'timeout_seconds': 99999999, 'is_default': None}, 'heartbeat': None, 'parameters': (Parameters| {'payload_tmpl': (PayloadTmpl| {'payload_bindings': [(PayloadBindingValue| {'field': 'FunctionName', 'value': (PayloadValueStr| {'val': 'arn:aws:lambda:us-east-1:000000000000:function:TestAppStack-lambdaslongrunning51EEA4-b04d9aee'}}, (PayloadBindingPath| {'field': 'Payload', 'path': '$'}]}}, 'name': 'long-running-task', 'state_type': <StateType.Task: 15>, 'continue_with': <localstack.services.stepfunctions.asl.component.state.state_continue_with.ContinueWithEnd object at 0xfffee6793b90>, 'resource': (ServiceResource| {'_region': '', '_account': '', 'resource_arn': 'arn:aws:states:::lambda:invoke', 'partition': 'aws', 'service_name': 'lambda', 'api_name': 'lambda', 'api_action': 'invoke', 'condition': None}}'
  ```
  
  Even if I specify long timeouts on both the Lambda and the LambdaTask the state machine still fails the task after 3 seconds. This was working in version 2, and if I use the old StepFunctions provider, the StateMachine completes successfully.
  
  ### Expected Behavior
  
  The State Machine should finish successfully because the long running lambda finishes before the timeout.
  
  ### How are you starting LocalStack?
  
  With a docker-compose file
  
  ### Steps To Reproduce
  
  #### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)
  
  I've created a repository that demonstrates the bug: https://github.com/noseworthy/localstack-sfn-bugs. I'm using localstack pro, so your terminal must have `LOCALSTACK_AUTH_TOKEN` specified. This should work with non-pro localstack however. You just need to modify the `compose.yaml` file.
  
  1. Start localstack using docker-compose:  `docker compose up --force-recreate --build -d`
  
  #### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
  
  1. Install dependencies: `yarn install`
  2. Bootstrap the CDK project: `yarn cdklocal bootstrap`
  3. Deploy the CDK project: `yarn cdklocal deploy`
  4. Trigger the state machine: `yarn trigger`
  
  Watch as the statemachine tries to execute, but fails saying that the long running lambda timed out after 3.00 seconds.
  
  ### Environment
  
  ```markdown
  - OS: macOS Sonoma 14.1.1 (23B81)
  - LocalStack: v3.0.1 Pro Docker Image
  ```
  
  
  ### Anything else?
  
  Demo Repository: https://github.com/noseworthy/localstack-sfn-bugs
  
  </issue>
  <code>
  [start of localstack/services/stepfunctions/asl/utils/boto_client.py]
  1 from botocore.client import BaseClient
  2 from botocore.config import Config
  3 
  4 from localstack.aws.connect import connect_to
  5 
  6 
  7 def boto_client_for(region: str, account: str, service: str) -> BaseClient:
  8     return connect_to.get_client(
  9         aws_access_key_id=account,
  10         region_name=region,
  11         service_name=service,
  12         config=Config(parameter_validation=False),
  13     )
  14
  [end of localstack/services/stepfunctions/asl/utils/boto_client.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/localstack/services/stepfunctions/asl/utils/boto_client.py b/localstack/services/stepfunctions/asl/utils/boto_client.py
  --- a/localstack/services/stepfunctions/asl/utils/boto_client.py
  +++ b/localstack/services/stepfunctions/asl/utils/boto_client.py
  @@ -2,6 +2,7 @@
   from botocore.config import Config
   
   from localstack.aws.connect import connect_to
  +from localstack.services.stepfunctions.asl.component.common.timeouts.timeout import TimeoutSeconds
   
   
   def boto_client_for(region: str, account: str, service: str) -> BaseClient:
  @@ -9,5 +10,10 @@
           aws_access_key_id=account,
           region_name=region,
           service_name=service,
  -        config=Config(parameter_validation=False),
  +        config=Config(
  +            parameter_validation=False,
  +            retries={"max_attempts": 0, "total_max_attempts": 1},
  +            connect_timeout=TimeoutSeconds.DEFAULT_TIMEOUT_SECONDS,
  +            read_timeout=TimeoutSeconds.DEFAULT_TIMEOUT_SECONDS,
  +        ),
       )
  
verification_info: {"golden_diff": "diff --git a/localstack/services/stepfunctions/asl/utils/boto_client.py b/localstack/services/stepfunctions/asl/utils/boto_client.py\n--- a/localstack/services/stepfunctions/asl/utils/boto_client.py\n+++ b/localstack/services/stepfunctions/asl/utils/boto_client.py\n@@ -2,6 +2,7 @@\n from botocore.config import Config\n \n from localstack.aws.connect import connect_to\n+from localstack.services.stepfunctions.asl.component.common.timeouts.timeout import TimeoutSeconds\n \n \n def boto_client_for(region: str, account: str, service: str) -> BaseClient:\n@@ -9,5 +10,10 @@\n         aws_access_key_id=account,\n         region_name=region,\n         service_name=service,\n-        config=Config(parameter_validation=False),\n+        config=Config(\n+            parameter_validation=False,\n+            retries={\"max_attempts\": 0, \"total_max_attempts\": 1},\n+            connect_timeout=TimeoutSeconds.DEFAULT_TIMEOUT_SECONDS,\n+            read_timeout=TimeoutSeconds.DEFAULT_TIMEOUT_SECONDS,\n+        ),\n     )\n", "issue": "bug: Long Running Lambda Fails StepFunction State Machine Execution\n### Is there an existing issue for this?\r\n\r\n- [X] I have searched the existing issues\r\n\r\n### Current Behavior\r\n\r\nAs of `v3.0.0` and `v3.0.1`, StepFunction StateMachines that have long-running Lambda tasks fail execution. It also looks like the StateMachine then retries by re-invoking the lambda 3 times in the background with a 1 minute gap in between invocations. Unfortunately, the state machine will have already failed execution by this point and these lambda runs fail when they try to update the state.\r\n\r\nThe lambda is started successfully, but then fails with a timeout after 3 seconds:\r\n\r\n```\r\n2023-11-24T22:09:56.758 ERROR --- [ad-35 (eval)] l.s.s.a.c.eval_component   : Exception=FailureEventException, Error=Exception, Details={\"taskFailedEventDetails\": {\"error\": \"Exception\", \"cause\": \"{\\\"errorMessage\\\":\\\"2023-11-24T22:09:56Z dbd4767f-32b8-46b7-9ef4-382ee583ad0a Task timed out after 3.00 seconds\\\"}\", \"resource\": \"invoke\", \"resourceType\": \"lambda\"}} at '(StateTaskServiceLambda| {'comment': None, 'input_path': (InputPath| {'input_path_src': '$'}, 'output_path': (OutputPath| {'output_path': '$'}, 'state_entered_event_type': 'TaskStateEntered', 'state_exited_event_type': 'TaskStateExited', 'result_path': None, 'result_selector': None, 'retry': (RetryDecl| {'retriers': [(RetrierDecl| {'error_equals': (ErrorEqualsDecl| {'error_names': [(CustomErrorName| {'error_name': 'Lambda.ClientExecutionTimeoutException'}, (CustomErrorName| {'error_name': 'Lambda.ServiceException'}, (CustomErrorName| {'error_name': 'Lambda.AWSLambdaException'}, (CustomErrorName| {'error_name': 'Lambda.SdkClientException'}]}, 'interval_seconds': (IntervalSecondsDecl| {'seconds': 2}, 'max_attempts': (MaxAttemptsDecl| {'attempts': 6}, 'backoff_rate': (BackoffRateDecl| {'rate': 2.0}, '_attempts_counter': 0, '_next_interval_seconds': 2}]}, 'catch': None, 'timeout': (TimeoutSeconds| {'timeout_seconds': 99999999, 'is_default': None}, 'heartbeat': None, 'parameters': (Parameters| {'payload_tmpl': (PayloadTmpl| {'payload_bindings': [(PayloadBindingValue| {'field': 'FunctionName', 'value': (PayloadValueStr| {'val': 'arn:aws:lambda:us-east-1:000000000000:function:TestAppStack-lambdaslongrunning51EEA4-b04d9aee'}}, (PayloadBindingPath| {'field': 'Payload', 'path': '$'}]}}, 'name': 'long-running-task', 'state_type': <StateType.Task: 15>, 'continue_with': <localstack.services.stepfunctions.asl.component.state.state_continue_with.ContinueWithEnd object at 0xfffee6793b90>, 'resource': (ServiceResource| {'_region': '', '_account': '', 'resource_arn': 'arn:aws:states:::lambda:invoke', 'partition': 'aws', 'service_name': 'lambda', 'api_name': 'lambda', 'api_action': 'invoke', 'condition': None}}'\r\n```\r\n\r\nEven if I specify long timeouts on both the Lambda and the LambdaTask the state machine still fails the task after 3 seconds. This was working in version 2, and if I use the old StepFunctions provider, the StateMachine completes successfully.\r\n\r\n### Expected Behavior\r\n\r\nThe State Machine should finish successfully because the long running lambda finishes before the timeout.\r\n\r\n### How are you starting LocalStack?\r\n\r\nWith a docker-compose file\r\n\r\n### Steps To Reproduce\r\n\r\n#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)\r\n\r\nI've created a repository that demonstrates the bug: https://github.com/noseworthy/localstack-sfn-bugs. I'm using localstack pro, so your terminal must have `LOCALSTACK_AUTH_TOKEN` specified. This should work with non-pro localstack however. You just need to modify the `compose.yaml` file.\r\n\r\n1. Start localstack using docker-compose:  `docker compose up --force-recreate --build -d`\r\n\r\n#### Client commands (e.g., AWS SDK code snippet, or sequence of \"awslocal\" commands)\r\n\r\n1. Install dependencies: `yarn install`\r\n2. Bootstrap the CDK project: `yarn cdklocal bootstrap`\r\n3. Deploy the CDK project: `yarn cdklocal deploy`\r\n4. Trigger the state machine: `yarn trigger`\r\n\r\nWatch as the statemachine tries to execute, but fails saying that the long running lambda timed out after 3.00 seconds.\r\n\r\n### Environment\r\n\r\n```markdown\r\n- OS: macOS Sonoma 14.1.1 (23B81)\r\n- LocalStack: v3.0.1 Pro Docker Image\r\n```\r\n\r\n\r\n### Anything else?\r\n\r\nDemo Repository: https://github.com/noseworthy/localstack-sfn-bugs\n", "before_files": [{"content": "from botocore.client import BaseClient\nfrom botocore.config import Config\n\nfrom localstack.aws.connect import connect_to\n\n\ndef boto_client_for(region: str, account: str, service: str) -> BaseClient:\n    return connect_to.get_client(\n        aws_access_key_id=account,\n        region_name=region,\n        service_name=service,\n        config=Config(parameter_validation=False),\n    )\n", "path": "localstack/services/stepfunctions/asl/utils/boto_client.py"}]}