Skip to content

Conversation

ianbotsf
Copy link
Contributor

@ianbotsf ianbotsf commented Sep 22, 2025

Issue #, if available:

(none)

Description of changes:

While attempting to re-enable some ignored smithy-kotlin tests discovered a NullPointerException being thrown when canceling a stream as part of a test. The root cause is that StableRef<T>.get() can throw NPE when the opaque pointer has been modified by CRT. Thus, this change rewrites the resource handling in HttpClientConnectionNative.kt to anticipate NPEs and handle them as gracefully as possible.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ianbotsf ianbotsf added the no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly. label Sep 22, 2025

This comment has been minimized.

3 similar comments

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@ianbotsf ianbotsf changed the title chore: re-enable K/N tests in smithy-kotlin fix: handle CRT native connection resources more carefully Sep 22, 2025
@ianbotsf ianbotsf marked this pull request as ready for review September 22, 2025 21:00
@ianbotsf ianbotsf requested a review from a team as a code owner September 22, 2025 21:00
}
}

private fun dereferenceUserdata(userdata: COpaquePointer?): StableRef<HttpStreamContext>? =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining why we need this? Similar to your explanation in the PR description

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do!

KonanTarget.WATCHOS_ARM64 -> "arm64_32"
else -> null
}
else -> null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compiler was complaining that the check was unnecessary because the when branches are already exhaustive.

This comment has been minimized.

Copy link

Affected Artifacts

Changed in size
Artifact Pull Request (bytes) Latest Release (bytes) Delta (bytes) Delta (percentage)
aws-crt-kotlin-jvm.jar 221,683 216,897 4,786 2.21%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants