Repository navigation
Commit eb36f3c
committed
lanlord: read a refusal even if sending the request failed
A Server may refuse a caller, by uid, before reading its request, and
then replies and closes. If that close won the race with the client's
write of its request, the write failed with EPIPE, and DialContext
returned "sending request: write: broken pipe" without reading the
reply that said why. A disallowed user would see that instead of "not
allowed", and TestRefusals/uid flaked on ubuntu-latest in CI.
Fix it in the Client rather than the Server, to keep the root side as
simple as possible. After a failed write, read the reply anyway, since
what the server wrote before closing is still readable, and report the
write error only if there is no reply. A write that failed because of
the context still returns the context's error at once.
go test -count=3000 -cpu=1,2,4 -run TestRefusals/uid reproduced the
failure before. With this, it passes, including runs where the write
got EPIPE.
Updates tailscale/corp#51929
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Change-Id: I17ffa4ec13b068ce572b060f7bac2e01afe299211 parent 7c001bc commit eb36f3c
1 file changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
287 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
288 | 293 | | |
289 | 294 | | |
290 | | - | |
291 | 295 | | |
292 | 296 | | |
293 | 297 | | |
294 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
295 | 302 | | |
296 | 303 | | |
297 | 304 | | |
| |||
0 commit comments