Skip to content

Commit

Permalink
Fix #271
Browse files Browse the repository at this point in the history
Silly mistake: when a pipelined question failed to send, we were
rejecting the promise for the *original* question, not the new one we
just failed to send -- so when the return message for the original came
back, we got a panic. Solution is to reject q2, not q.

Note that the tests also needed tweaking, because we don't expect no
error, we just don't want a panic -- the error should reflect the
canceled context.
  • Loading branch information
zenhack committed Aug 8, 2022
1 parent 8fcd7eb commit 779b538
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rpc/level0_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ func TestHandleReturn_regression(t *testing.T) {
defer release()

_, err := f.Struct()
assert.NoError(t, err)
assert.ErrorIs(t, err, ctx.Err())
})

t.Run("BootstrapWithExpiredContext", func(t *testing.T) {
Expand All @@ -1817,7 +1817,7 @@ func TestHandleReturn_regression(t *testing.T) {
defer release()

_, err := f.Struct()
assert.NoError(t, err)
assert.ErrorIs(t, err, ctx.Err())
})
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/question.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (q *question) PipelineSend(ctx context.Context, transform []capnp.PipelineO
q.c.questions[q2.id] = nil
q.c.questionID.remove(uint32(q2.id))
})
q.p.Reject(rpcerr.Failedf("send message: %w", err))
q2.p.Reject(rpcerr.Failedf("send message: %w", err))
return
}

Expand Down

0 comments on commit 779b538

Please sign in to comment.