Skip to content

Commit

Permalink
Enforce a hard timeout for incoming processing (Velocidex#2074)
Browse files Browse the repository at this point in the history
Some clients connections drop before we are able to fully process the
data. Previously this caused the processing to be cancelled but this
is unreliable.
  • Loading branch information
scudette authored Sep 13, 2022
1 parent 49fac4d commit d079d0a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion server/comms.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,16 @@ func control(
go func() {
defer close(sync)

response, _, err := server_obj.Process(ctx, message_info,
// Process the request with a different context - if the
// client disconnects quickly the request will be
// cancelled and aborted. This seems to happen sometimes
// on some clients so we enforce a hard timeout for
// processing anyway.
subctx, cancel := context.WithTimeout(context.Background(),
60*time.Second)
defer cancel()

response, _, err := server_obj.Process(subctx, message_info,
false, // drain_requests_for_client
)
if err != nil {
Expand Down

0 comments on commit d079d0a

Please sign in to comment.