Commit 21d4dac
authored
Harden SMB startup, quieter protocol errors, and add tests/benches (#21)
* Harden SMB startup, quieter protocol errors, and add tests/benches
Three resilience changes plus the tests and benchmarks for them.
Setup action: dump the spiceio log on failure (both unexpected exit and
timeout). The log was being written to RUNNER_TEMP but never echoed, so
when startup stalled past the grace window there was no way to diagnose
which phase hung. Also doubled the grace from 30s to 60s — the previous
good run took ~12s, leaving only ~2.5x headroom for a slow server day.
TCP connect timeout: TcpStream::connect had no spiceio-level timeout, so
a server dropping SYNs left the OS waiting 75-90s and stalled pool init
past any sensible CI window. Wrapped in tokio::time::timeout(15s) with
explicit TimedOut error.
Pool connection retry: extracted retry_with_backoff helper used by
SmbPool::connect with a 250ms/750ms/2s schedule (4 attempts). A flaky
connection during startup no longer takes down the whole pool init.
Quieter protocol-layer logging: smb_status_to_io_error was emitting an
error log for every SMB status, including expected ones (NotFound on HEAD
probes, SharingViolation during WAL cleanup). Removed the unconditional
log; mapped statuses return their typed io::Error silently and the
catchall arm still logs for truly unknown statuses. Added
STATUS_SHARING_VIOLATION (0xC0000043) -> ErrorKind::ResourceBusy.
Tests (+21, now 142 total):
- smb_status_to_io_error: full mapping coverage including the new
ResourceBusy case, unknown-status fallback, STATUS_SUCCESS panic guard,
path preservation
- retry_with_backoff: first-attempt success, success after transient
failures, exhaustion preserving last error, empty-backoff edge case,
elapsed-time floor from the schedule, and the structural invariant on
CONNECT_RETRY_BACKOFF
- parse_compound_response (moved from client.rs to protocol.rs as pub):
single/multi-message, empty, truncated header, malformed next_command
Benches (+3 in protocol_bench.rs):
- parse_compound_response over n=2,4,8 chained messages
- pipelined_read_decode at (depth, chunk_size) = (8,64K), (64,64K), (64,8K)
— the GetObject hot-path inner loop with throughput reporting
- pipelined_write_encode at (depth, chunk_size) = (8,64K), (64,64K),
(64,1M) — the WAL pipelined-write inner loop
* Bump version to v0.5.2
* Address PR review: tighten bad next_command test, remove orphan comment
* Add comprehensive CI live tests and fix region flakiness
Wires two new live-test scripts into the CI job:
- scripts/test-extended.sh — exercises operations not covered by
test-sccache.sh: multipart uploads (single + N concurrent at 10MB
each), range GETs (sequential + N concurrent slices of a 4MB file),
multi-delete (DeleteObjects batch via aws s3api delete-objects),
conditional writes (If-None-Match: * happy and 412 paths plus N
racing writers documenting the observable winner/loser ratio),
ListObjectsV2 during concurrent PUTs, and streaming GET
cancellation (verifies spiceio stays healthy after a client
disconnects mid-stream).
- scripts/stress-concurrent.sh — already existed but was not in CI.
Adds it: concurrent writes to distinct keys, concurrent reads of
the same key, write-then-read (sccache pattern), mixed read/write
contention on the same key (with data-corruption guard), and
concurrent large-file pipelined I/O.
Each script runs on its own port (18335, 18336) so they don't collide
with the existing sccache test on 18333.
Defensive fix to test-sccache.sh: AWS CLI now gets --region
explicitly, and the first ListBuckets call retries up to 3× and
surfaces stderr on failure. Previously a missing AWS_DEFAULT_REGION
on the runner would cause aws s3 ls to fail and set -e would kill
the script before its captured stderr ever got printed, leaving the
real error invisible. The CI job now also sets AWS_DEFAULT_REGION
for the new test steps.
* Address PR review and relax conditional-write race assertion
- smb_status_to_io_error doc clarified: only the fallback arm formats
the raw hex; mapped arms rely on the typed ErrorKind.
- retry_with_backoff: emit a concise "retrying (attempt N/max) in Xms"
notice at slog level. SmbClient::connect already logs the underlying
error per attempt, so the previous duplicate "attempt N/M failed: {e}"
line was pure noise.
- test-extended.sh section 7: relax the racing conditional-write check
so the test fails only on hangs ("000") or a missing response, not on
the occasional 5xx surfaced by SMB-level contention. Print the offending
status lines on the rare path so we can investigate without flaking CI.1 parent 18e298c commit 21d4dac
11 files changed
Lines changed: 1015 additions & 57 deletions
File tree
- .github
- actions/setup
- workflows
- benches
- scripts
- src/smb
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
138 | 141 | | |
139 | 142 | | |
140 | 143 | | |
| |||
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
149 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
150 | 157 | | |
151 | 158 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
99 | 130 | | |
100 | 131 | | |
101 | 132 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
155 | 282 | | |
156 | 283 | | |
157 | 284 | | |
| |||
192 | 319 | | |
193 | 320 | | |
194 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
195 | 325 | | |
196 | 326 | | |
197 | 327 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
0 commit comments