Describe the bug
When running tests that initialize DynamoDBClient on GitHub Actions Linux runners (Ubuntu 22.04 and 24.04) using Swift 6.2.4 installed from swift.org tarballs, the process intermittently crashes with a fatal error during TLS context initialization or endpoint ruleset parsing.
The crash is non-deterministic — approximately 30–50% of CI runs fail. The same code passes consistently on macOS.
Expected Behavior
DynamoDBClient initializes successfully without crashing.
Current Behavior
The process crashes with one of three symptoms depending on the run and Ubuntu version:
Ubuntu 24.04 — TLS context creation failure (SIGILL):
ClientRuntime/SDKDefaultIO.swift:77: Fatal error: Tls Context failed to create.
This should never happen. Please open a Github issue with us at
https://github.com/awslabs/aws-sdk-swift.
Ubuntu 24.04 — Endpoint ruleset parsing failure:
crtError(AwsCommonRuntimeKit.CRTError(
code: 15364,
message: "Ruleset parsing failed",
name: "AWS_ERROR_SDKUTILS_ENDPOINTS_PARSE_FAILED"
))
Stack trace shows the crash in aws-crt-swift's C code during endpoint ruleset JSON parsing:
Thread 1:
0 case_insensitive_strcmp in aws-c-common/source/external/cJSON.c:155
1 get_object_item in cJSON.c:1969
2 cJSON_GetObjectItem in cJSON.c:1984
3 cJSON_HasObjectItem in cJSON.c:1994
4 aws_json_value_get_from_object_c_str in aws-c-common/source/json.c:128
5 s_try_parse_reference in aws-c-sdkutils/source/endpoints_ruleset.c:229
...
17 s_parse_endpoints_rule_data_tree in endpoints_ruleset.c:742
Ubuntu 22.04 — Memory corruption (SIGABRT):
double free or corruption (out)
*** Signal 6: Aborted ***
Reproduction Steps
A minimal reproduction repository is available at:
https://github.com/tachyonics/swift-aws-issue-reproduction
The reproduction contains:
- A minimal
Package.swift with only AWSDynamoDB as a dependency
- Two tests: single client init and concurrent (5 parallel) client init
- A GitHub Actions workflow that runs each test on Ubuntu 22.04, Ubuntu 24.04, and macOS — with 3 attempts per OS to demonstrate the
non-deterministic nature
Results from the reproduction: tachyonics/swift-aws-issue-reproduction#1
- macOS: 3/3 attempts pass ✅
- Ubuntu 22.04: Intermittent crashes
- Ubuntu 24.04: Intermittent crashes
Swift is installed directly from swift.org tarballs (no third-party action), ruling out action-specific packaging as a cause.
The test code is minimal:
import AWSDynamoDB
import SmithyIdentity
import Testing
@Test func clientInit() throws {
let credentials = AWSCredentialIdentity(accessKey: "test", secret: "test")
let config = try DynamoDBClient.DynamoDBClientConfig(
awsCredentialIdentityResolver: StaticAWSCredentialIdentityResolver(credentials),
region: "us-east-1",
endpoint: "https://localhost:4566"
)
let _ = DynamoDBClient(config: config)
}
### Possible Solution
The crash site is in cJSON_GetObjectItem during endpoint ruleset parsing, suggesting either:
- A memory-safety issue in the CRT's cJSON/ruleset parser triggered by specific allocator behavior on Linux
- A race condition during CRT static initialization when multiple threads access the TLS context
### Additional Information/Context
- This appears related to #1984, which was closed without resolution.
- The crash does not occur inside the official swift:6.2.4-noble Docker image — only on bare GitHub Actions runners with Swift installed from tarballs.
- System diagnostics confirm libssl 3.x, libcurl (OpenSSL flavor), and CA certificates are all present and correctly installed on the runners.
- Setting SSL_CERT_FILE / SSL_CERT_DIR environment variables does not resolve the issue.
### AWS SWIFT SDK version used
1.6.89
### Compiler and Version used
Swift 6.2.4 (swift.org release tarball for Ubuntu 22.04 and 24.04)
### Operating System and version
Ubuntu 22.04.5 LTS and Ubuntu 24.04.4 LTS
Describe the bug
When running tests that initialize
DynamoDBClienton GitHub Actions Linux runners (Ubuntu 22.04 and 24.04) using Swift 6.2.4 installed from swift.org tarballs, the process intermittently crashes with a fatal error during TLS context initialization or endpoint ruleset parsing.The crash is non-deterministic — approximately 30–50% of CI runs fail. The same code passes consistently on macOS.
Expected Behavior
DynamoDBClientinitializes successfully without crashing.Current Behavior
The process crashes with one of three symptoms depending on the run and Ubuntu version:
Ubuntu 24.04 — TLS context creation failure (SIGILL):
ClientRuntime/SDKDefaultIO.swift:77: Fatal error: Tls Context failed to create.
This should never happen. Please open a Github issue with us at
https://github.com/awslabs/aws-sdk-swift.
Ubuntu 24.04 — Endpoint ruleset parsing failure:
crtError(AwsCommonRuntimeKit.CRTError(
code: 15364,
message: "Ruleset parsing failed",
name: "AWS_ERROR_SDKUTILS_ENDPOINTS_PARSE_FAILED"
))
Stack trace shows the crash in aws-crt-swift's C code during endpoint ruleset JSON parsing:
Thread 1:
0 case_insensitive_strcmp in aws-c-common/source/external/cJSON.c:155
1 get_object_item in cJSON.c:1969
2 cJSON_GetObjectItem in cJSON.c:1984
3 cJSON_HasObjectItem in cJSON.c:1994
4 aws_json_value_get_from_object_c_str in aws-c-common/source/json.c:128
5 s_try_parse_reference in aws-c-sdkutils/source/endpoints_ruleset.c:229
...
17 s_parse_endpoints_rule_data_tree in endpoints_ruleset.c:742
Ubuntu 22.04 — Memory corruption (SIGABRT):
double free or corruption (out)
*** Signal 6: Aborted ***
Reproduction Steps
A minimal reproduction repository is available at:
https://github.com/tachyonics/swift-aws-issue-reproduction
The reproduction contains:
Package.swiftwith onlyAWSDynamoDBas a dependencynon-deterministic nature
Results from the reproduction: tachyonics/swift-aws-issue-reproduction#1
Swift is installed directly from swift.org tarballs (no third-party action), ruling out action-specific packaging as a cause.
The test code is minimal: