Skip to content

Commit

Permalink
fix context leaks in all thrift servers
Browse files Browse the repository at this point in the history
Summary:
fix context leaks in all thrift servers

This is based on the context leak found here D65803408

Reviewed By: mge-fbe-com, skogtwin

Differential Revision: D65816207

fbshipit-source-id: dae03532f769a179ff1051fefc0ba4e7f73404af
  • Loading branch information
awalterschulze authored and facebook-github-bot committed Nov 12, 2024
1 parent 5a6677d commit 83a1cf2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions thrift/lib/go/thrift/header_simple_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func (s *headerSimpleServer) acceptLoop(ctx context.Context) error {
}

go func(ctx context.Context, conn net.Conn) {
ctx = s.connContext(ctx, conn)
if err := s.processRequests(ctx, conn); err != nil {
ctxConn := s.connContext(ctx, conn)
if err := s.processRequests(ctxConn, conn); err != nil {
s.log("error processing request from %s: %s\n", conn.RemoteAddr(), err)
cerror := conn.Close()
if cerror != nil {
Expand Down
4 changes: 2 additions & 2 deletions thrift/lib/go/thrift/rocket_server_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ func (r *rocketServerTransport) acceptLoop(ctx context.Context) error {
}
}

ctx = r.connContext(ctx, conn)
r.processRequests(ctx, conn)
ctxConn := r.connContext(ctx, conn)
r.processRequests(ctxConn, conn)
}(ctx, conn)
}
}
Expand Down
4 changes: 2 additions & 2 deletions thrift/lib/go/thrift/rocket_simple_server_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ func (r *rocketSimpleServerTransport) acceptLoop(ctx context.Context) error {
}
}

ctx = r.connContext(ctx, conn)
r.processRequests(ctx, conn)
ctxConn := r.connContext(ctx, conn)
r.processRequests(ctxConn, conn)
}(ctx, conn)
}
}
Expand Down

0 comments on commit 83a1cf2

Please sign in to comment.