aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-01-22 15:39:18 +0100
committerAleksandr Nogikh <nogikh@google.com>2025-01-22 16:34:22 +0000
commitac680c7cc91ea82316471433537f3101c2af39ea (patch)
treef4175d7bec39c64d1083057433dcce58c1720d67 /pkg
parenta44b0418acb3ae8fdad9277c2f2aaa6446b97530 (diff)
pkg/rpcserver: prevent a nil pointer dereference
If we get a Hanged != "" response from a non-RequestTypeProgram request, we used to end up trying to serialize an nil *prog.Prog value. Add a missing if condition.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/rpcserver/runner.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/rpcserver/runner.go b/pkg/rpcserver/runner.go
index 9ac1a6866..a6b763b9a 100644
--- a/pkg/rpcserver/runner.go
+++ b/pkg/rpcserver/runner.go
@@ -436,7 +436,10 @@ func (runner *Runner) handleExecResult(msg *flatrpc.ExecResult) error {
resErr = errors.New(msg.Error)
} else if msg.Hanged {
status = queue.Hanged
- runner.lastExec.Hanged(int(msg.Id), int(msg.Proc), req.Prog.Serialize(), osutil.MonotonicNano())
+ if req.Type == flatrpc.RequestTypeProgram {
+ // We only track the latest executed programs.
+ runner.lastExec.Hanged(int(msg.Id), int(msg.Proc), req.Prog.Serialize(), osutil.MonotonicNano())
+ }
runner.hanged[msg.Id] = true
}
req.Done(&queue.Result{