Fix crashes related to breaking Swift language changes to withMemoryRebound in Xcode 14#100
Merged
beckychristensen merged 1 commit intoenvoy:masterfrom Oct 11, 2022
Conversation
|
thanks you. I hope that will merge soon. |
samrayner
approved these changes
Sep 14, 2022
|
@Goos Hi, can you merge this PR, please? it is blocker for usage the library with Xcode 14. |
|
Hello, does anyone know when this will be merged? |
|
@Goos @samrayner Hello Any plans to merge this PR. I like this project and do not want to fork it... Thanks a lot! |
|
Costa Coffee loves this project too! We’ve applied this change but it would be great to have the PR merged in 🙏🏻 |
Contributor
|
Sorry for the delay on this, and thanks @JRR-OSU for providing a fix! I'll create a new release including this fix tomorrow |
|
Thank you! :) |
|
Awesome, thank you so much @beckychristensen! Look forward to the release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR fixes crashes presumably related to S3-0333 which adjusted the behavior of withMemoryRebound. These crashes prevent us from using this framework in Xcode 14 beta likely due to SE-0333 being accepted and included in its release.
Explanation
According to the docs of
withMemoryReboundthe parameter count refers to "the number of instances ofPointeeto bind totype." This means that it does not actually refer to the size of the rebound region, but instead to the number of instances ofTbeing mapped within it. The previous implementation passed the size of theMemoryLayoutrather than simply passing 1, which is the number ofsocketaddrinstances we're attempting to map/bind to.The proposal linked previously asserted that these changes would not break source compatibility, but I have found this assumption to be flawed. Even though TCPSocket's previous implementation appeared to misunderstand the intent of the capacity parameter, it functioned nonetheless. I am willing to file an issue to the Swift team if there's anyone that can help me distill this issue down.
My fix has seemed to resolved the crashes on our end, but I would gladly appreciate others to verify my understanding. I am not too well-accustomed to C land, so it is entirely possible my understanding is flawed as well.
In any case, if these changes can be verified and merged as soon as possible, we would be much appreciative, as we would love to continue using this library in Xcode 14 onward.
Thank you!