Upgrade grpc-swift-nio-transport to 2.9.0 and remove HTTP2ConnectBuff…
Type of Change
- [ ] Bug fix
- [x] New feature
- [ ] Breaking change
- [ ] Documentation update
Motivation and Context
Release 2.9.0 of grpc-swift-nio-transport fixes an HTTP/2 initialization race where the server could send SETTINGS before gRPC handlers are added to the pipeline, causing the client to hang. The new WrappedChannel.wrapping(config:serviceConfig:makeChannel:) API calls configure(channel) inside the channel initializer, ensuring the pipeline is set up before any inbound bytes arrive. This eliminates the need for the custom HTTP2ConnectBufferingHandler workaround.
Fixes #1789.
Changes
- Bump
grpc-swift-nio-transportdependency from2.4.4to2.9.0inPackage.swift - Update
Package.resolvedto pin2.9.0(revision2ca31f0) - Replace manual
ClientBootstrap+HTTP2ConnectBufferingHandlerpipeline setup with the new asyncHTTP2ClientTransport.WrappedChannel.wrapping(config:serviceConfig:makeChannel:)API viawithCheckedThrowingContinuation - Remove private
HTTP2ConnectBufferingHandlerclass and unused imports (NIOCore,NIOHPACK,NIOHTTP2) - Make
Builder.init(socket:group:logger:)async throwsto support the new async API - Update caller in
BuildCommand.swiftto usetry await Builder(...)
Testing
- [x] Tested locally — both
ContainerBuildandContainerCommandstargets build cleanly
Checklist
- [x] My code follows the code style of this project
- [x] I have read the CONTRIBUTING document
@adityabagchi24 Thanks for jumping on this so quickly! It looks okay but we can't build yet. Could you try running make fmt and pushing the changes?
Also, it'd be awesome if you could apply the same fix to Vminit.swift in the containerization repo: https://github.com/apple/containerization/issues/776.
@jglogan I have run make-fmt and pushed the changes.
As for the containerization repo fix I have done them. I've already opened apple/containerization#778. Please check it out as well.
@jglogan The formatting issue is fixed now — there was a minor disagreement between two different formatting tools about a blank line at the end of the file. Both are now aligned, so the next run should pass.
Code Coverage
| Tier | Line Coverage |
|---|---|
| Unit | 22.53% |
| Integration | 66.42% |
| Combined | 75.34% |
@adityabagchi24 Building clean now. I'm going to hold off merging this and the sister change down in containerization until after the 1.1.0 release. That this builds is very good evidence that the fix in the grpc transport library 2.9.0 is valid, but waiting for the next release will allow us to do more regression testing.
Thank you again for taking care of this.
@jglogan Thank you for the update! That sounds like a good plan. I'm glad this provides useful validation for the fix in grpc transport library 2.9.0. I completely understand waiting until after the 1.1.0 release to allow for additional regression testing. Thank you again for your guidance throughout this process. I’m looking forward to seeing this and the related containerization changes merged after the release. Please let me know if there’s anything I can help with in the meantime.
@adityabagchi24 Merged, thank you! I've tagged containerization and will update the dependency to pull in your library fix.
@jglogan Thank you so much for your cooperation and patience throughout the process of merging my PR. I truly appreciate your support. Please feel free to reach out if there's ever anything I can assist you with in the future.