fix(bindings/bench): Prevent IO from going out of scope #5007
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
#4847 moved the ownership of the IO streams into
TlsConnPair
. After this change, the resumption benchmark started failing. I think this change affected theTlsConnPair::split
API, which consumed theTlsConnPair
and returned the underlying client and serverTlsConnection
s. However, now that theTlsConnPair
also owns the IO streams, I think this caused the streams to be dropped, which caused the s2n-tls send/recv callbacks to access invalid memory aftersplit
was called.This PR removes the
TlsConnPair::split
API to prevent the IO streams from being dropped, and instead provides references to the underlying client and server.The benchmarks were further broken by #4983, which changed the paths to the bench crate. This PR also updates these paths.
Both of these issues were not caught at PR-time since the bench action currently only runs on pushes to main. To catch similar issues in the future, this PR updates the bench action to build and run on PRs (but not publish any metrics until it's merged).
Call-outs:
None
Testing:
The bench action will now run on all PRs, with the authenticate/publish steps skipped. So the bench action on this PR should build and run successfully: https://github.com/aws/s2n-tls/actions/runs/12677767236/job/35333826698?pr=5007
I temporarily allowed the metrics to be published on PRs in c84990c in order to test this step: https://github.com/aws/s2n-tls/actions/runs/12677418611/job/35332715910?pr=5007
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.