Commit a239892
authored
feat(broker): route fduty egress through the runner broker (#35)
* feat(broker): per-dial SCM_RIGHTS http client for sandbox egress
* feat(broker): route fduty egress through runner broker when FLASHDUTY_CRED_FD is set
* fix(broker): reject stdio fds and cap idle broker conns
- FLASHDUTY_CRED_FD must be >= 3: fds 0/1/2 are stdio and can never be
the runner-injected control end, so reject them instead of handshaking
on stdin/stdout.
- MaxIdleConnsPerHost=1 on the broker transport: all dials target the
same sentinel host over the one control fd, so a single idle keep-alive
conn suffices and dispatched conns don't linger.
- Tests: stdio/invalid fd rejection, the 0xFF broker-refusal path surfaces
as an error (no hang), and both-keys-set still takes the broker path
(the sentinel, not the configured app key, reaches the wire).
* fix(broker): check deferred Close return values in test (errcheck)
First broker PR, so the linter surfaces the original test helpers too.
Wrap the deferred syscall.Close / conn.Close calls so errcheck passes.
* fix(broker): wake test broker goroutine with Shutdown, not Close (Linux)
The CLI broker tests deadlocked on linux-amd64 CI (10m timeout) while
passing on macOS/Windows: a bare close() does not interrupt a recvmsg
blocked on that fd in another goroutine on Linux (it does on darwin/BSD).
fakeBroker and TestBrokerHTTPClient_RefusedReturnsError join their control
goroutine after teardown, so they hung waiting for a recvmsg that never
returned. Use syscall.Shutdown(SHUT_RDWR) to wake the blocked recvmsg
portably, then join, then close.
Verified: the cross-compiled linux/arm64 test binary runs clean (count=2)
in an ubuntu container; native darwin still passes.1 parent 8c0898c commit a239892
6 files changed
Lines changed: 437 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
0 commit comments