Commit d3d3740
committed
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 loop1 parent 18e298c commit d3d3740
5 files changed
Lines changed: 517 additions & 52 deletions
| 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 | |
|---|---|---|---|
| |||
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 | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
18 | 23 | | |
19 | 24 | | |
20 | 25 | | |
| |||
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
84 | 98 | | |
85 | 99 | | |
86 | 100 | | |
| |||
1193 | 1207 | | |
1194 | 1208 | | |
1195 | 1209 | | |
1196 | | - | |
1197 | | - | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
1198 | 1214 | | |
1199 | 1215 | | |
1200 | 1216 | | |
| |||
1212 | 1228 | | |
1213 | 1229 | | |
1214 | 1230 | | |
1215 | | - | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
1216 | 1240 | | |
1217 | 1241 | | |
1218 | 1242 | | |
| |||
1232 | 1256 | | |
1233 | 1257 | | |
1234 | 1258 | | |
1235 | | - | |
1236 | | - | |
1237 | | - | |
1238 | | - | |
| 1259 | + | |
1239 | 1260 | | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
1243 | | - | |
1244 | | - | |
1245 | | - | |
1246 | | - | |
1247 | | - | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
1248 | 1264 | | |
1249 | | - | |
1250 | | - | |
1251 | | - | |
1252 | | - | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
1263 | 1270 | | |
1264 | | - | |
1265 | | - | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
1266 | 1276 | | |
1267 | | - | |
1268 | | - | |
1269 | | - | |
1270 | | - | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
1271 | 1281 | | |
1272 | 1282 | | |
1273 | | - | |
1274 | | - | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
1275 | 1288 | | |
1276 | | - | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
0 commit comments