Skip to content

Commit

Permalink
Reset deadline in SetupFrame
Browse files Browse the repository at this point in the history
Summary:
I don't know if this is actively occurring in production.
But this seems like a possible bug given the right timing.

https://www.internalfb.com/code/fbsource/[57bb7b036d04]/third-party/go/1.23.4/linux_amd64/src/net/net.go?lines=140-161

Reviewed By: leoleovich

Differential Revision: D68134703

fbshipit-source-id: e9ab7b6f26a6bf00902a76bd834d574cf7aabcc1
  • Loading branch information
echistyakov authored and facebook-github-bot committed Jan 14, 2025
1 parent d4dc23e commit ebacd42
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion thrift/lib/go/thrift/rocket_rsocket_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func (r *rsocketClient) SendSetup(_ context.Context) error {
if err != nil {
return err
}
// Very important to reset the deadline! Especially when using UpgradeToRocket.
// We may have inherited this connection from Header protocol after an Upgrade.
// Deadlines may be nearing expiration, if not reset - rsocket setup may fail.
r.resetDeadline()
// See T182939211. This copies the keep alives from Java Rocket.
// KeepaliveLifetime = time.Duration(missedAcks = 1) * (ackTimeout = 3600000)
clientBuilder := rsocket.Connect().
Expand Down Expand Up @@ -97,7 +101,7 @@ func (r *rsocketClient) onServerMetadataPush(pay payload.Payload) {
func transporter(conn net.Conn) func(_ context.Context) (*transport.Transport, error) {
return func(_ context.Context) (*transport.Transport, error) {
tconn := transport.NewTCPClientTransport(conn)
tconn.SetLifetime(time.Millisecond * 3600000)
tconn.SetLifetime(1 * time.Hour)
return tconn, nil
}
}
Expand Down

0 comments on commit ebacd42

Please sign in to comment.