Commit b6ffc0a
authored
Issue 32: end the send side on an abrupt local close, not only on EOF (#38)
* tunnel: end the send side on an abrupt local close, not only on EOF
Issue 32. A finished outbound session could leave the SERVER counting it as
attached for 40 seconds or more on Linux, while macOS released in about 53 ms.
It was never a slow path. A dropped local socket reads as a clean zero-length
read on macOS and as an error on Linux. Only the EOF branch recorded the send
close, and only a recorded send close makes the writer emit Frame::Close. With
no such frame the server waited for bytes that could never arrive. A 750x
platform gap is a different code path, not a slower one.
PR 31 released the recycle guard on this branch so the stall could not pin the
endpoint, and deliberately left the teardown semantics alone. This finishes the
job: the abrupt branch now calls mark_send_closed, which records the final
offset and releases the guard. Only the send side closes, because the session
may still be writing queued remote output and a half-close is not a close.
Proved without Linux and without CI timing. The platform difference is one
decision, EOF against error, so a test injects it directly through the boxed
local reader. Before this change the abrupt case left send_closed at None while
the clean case set it to Some(5); now they agree. That turns a Linux-only, racy,
40-second failure into a deterministic assertion that runs anywhere in
milliseconds.
A second test asserts the server-side outcome end to end: after the client drops
its local end, the server's active attach count must reach zero. It carries a
positive control that the server really counted the attach first, so a server
that never counted the session cannot pass it for the wrong reason. That test
passes on macOS either way, because macOS always took the branch that worked; it
is the Linux regression guard.
The recycle-guard release is now asserted for BOTH endings beside the new case,
so a later change cannot fix one ending and quietly regress the other.
194 lib tests green.
* test: isolate the issue-32 defect with a quiet tunnel, not a shell
The first end-to-end test used a shell and passed on Linux CI with the defect
present, so it guarded nothing. A shell streams output back, so a dropped local
socket fails on the next WRITE and tears the session down by a second route that
hides the missing close frame.
The original trace was a quiet tunnel. With nothing to write back, the missing
frame is the only thing that could end the session, which is what isolates the
defect.
* test: stop claiming the end-to-end test guards issue 32
It does not, and I presented it as though it did. Twice.
Issue 32 lives in the branch where the local read returns an ERROR. Dropping a
UnixStream in-process closes it cleanly, so both platforms take the EOF branch
in this test and neither reaches the defect. Linux CI confirmed it twice against
the pre-fix teardown: the shell version passed, and so did the quiet-tunnel
version I wrote to replace it.
My masking explanation for the first failure was wrong too. The shell was not
hiding the defect behind a write failure; the test never reached the error
branch at all.
The real guard is the unit test, which injects the ending directly and fails on
every platform when the defect is present. This test is renamed to what it
actually proves: a CLEAN local close detaches the session on the server. That is
worth keeping and is not the issue-32 guard.1 parent 26ecf6c commit b6ffc0a
2 files changed
Lines changed: 209 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6143 | 6143 | | |
6144 | 6144 | | |
6145 | 6145 | | |
| 6146 | + | |
| 6147 | + | |
| 6148 | + | |
| 6149 | + | |
| 6150 | + | |
| 6151 | + | |
| 6152 | + | |
| 6153 | + | |
| 6154 | + | |
| 6155 | + | |
| 6156 | + | |
| 6157 | + | |
| 6158 | + | |
| 6159 | + | |
| 6160 | + | |
| 6161 | + | |
| 6162 | + | |
| 6163 | + | |
| 6164 | + | |
| 6165 | + | |
| 6166 | + | |
| 6167 | + | |
| 6168 | + | |
| 6169 | + | |
| 6170 | + | |
| 6171 | + | |
| 6172 | + | |
| 6173 | + | |
| 6174 | + | |
| 6175 | + | |
| 6176 | + | |
| 6177 | + | |
| 6178 | + | |
| 6179 | + | |
| 6180 | + | |
| 6181 | + | |
| 6182 | + | |
| 6183 | + | |
| 6184 | + | |
| 6185 | + | |
| 6186 | + | |
| 6187 | + | |
| 6188 | + | |
| 6189 | + | |
| 6190 | + | |
| 6191 | + | |
| 6192 | + | |
| 6193 | + | |
| 6194 | + | |
| 6195 | + | |
| 6196 | + | |
| 6197 | + | |
| 6198 | + | |
| 6199 | + | |
| 6200 | + | |
| 6201 | + | |
| 6202 | + | |
| 6203 | + | |
| 6204 | + | |
| 6205 | + | |
| 6206 | + | |
| 6207 | + | |
| 6208 | + | |
| 6209 | + | |
| 6210 | + | |
| 6211 | + | |
| 6212 | + | |
| 6213 | + | |
| 6214 | + | |
| 6215 | + | |
| 6216 | + | |
| 6217 | + | |
| 6218 | + | |
| 6219 | + | |
| 6220 | + | |
| 6221 | + | |
| 6222 | + | |
| 6223 | + | |
| 6224 | + | |
| 6225 | + | |
| 6226 | + | |
| 6227 | + | |
| 6228 | + | |
| 6229 | + | |
| 6230 | + | |
| 6231 | + | |
| 6232 | + | |
| 6233 | + | |
| 6234 | + | |
| 6235 | + | |
| 6236 | + | |
| 6237 | + | |
| 6238 | + | |
| 6239 | + | |
| 6240 | + | |
| 6241 | + | |
| 6242 | + | |
| 6243 | + | |
| 6244 | + | |
| 6245 | + | |
| 6246 | + | |
| 6247 | + | |
6146 | 6248 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
542 | 546 | | |
543 | | - | |
544 | 547 | | |
545 | | - | |
546 | | - | |
547 | | - | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
548 | 556 | | |
549 | 557 | | |
550 | 558 | | |
| |||
2075 | 2083 | | |
2076 | 2084 | | |
2077 | 2085 | | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
2078 | 2177 | | |
0 commit comments