Commit 23d4122
authored
Fix intermittent CA test failure on Windows CI when TEMP is unset (#3161)
### Description of changes:
CA tests (`CATest.DatabaseWithRevokedEntryBasicTimestamp`,
`CATest.CustomEndDate`, etc.) fail intermittently on the
`windows-ltsc2022_sde-x86_64` CI job due to two issues with
`WIN32_rename`:
1. **Temp files landing in `C:\Windows\`**: `GetTempPathA` falls back to
the Windows directory when `TMP`, `TEMP`, and `USERPROFILE` are all
unset — which is the case when running as SYSTEM in our Docker-based CI.
This introduces a `GetSafeTempPathA` wrapper that detects the fallback
and redirects to `C:\Windows\Temp\` instead.
2. **NTFS pending-delete race in `WIN32_rename`**: The `DeleteFile` +
`MoveFile` workaround for `ERROR_ALREADY_EXISTS` is racy. NTFS defers
file removal until all handles are closed, so `DeleteFile` can return
success while the file is still visible. The subsequent `MoveFile` fails
with `ERROR_ALREADY_EXISTS` (183), which wasn't in the retryable error
set, so the retry budget was never used. Replaced with `MoveFileEx`
using `MOVEFILE_REPLACE_EXISTING`, which atomically replaces the target
— matching POSIX `rename()` semantics.
### Call-outs:
`CATest::TearDown` was missing cleanup of `.new` and `.attr.new` files.
These get left behind when a test fails between `SaveIndex` and
`RotateIndex`. Added while in here.
See failure
[here](https://github.com/aws/aws-lc/actions/runs/24354082397/job/71116230692?pr=2934#step:4:3018).
### Testing:
Existing CA tests cover this path. The fix should be verified by the
`windows-ltsc2022_sde-x86_64` job no longer failing intermittently.
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.1 parent be77a8a commit 23d4122
3 files changed
Lines changed: 46 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 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 | + | |
185 | 216 | | |
186 | 217 | | |
187 | 218 | | |
188 | 219 | | |
189 | | - | |
| 220 | + | |
190 | 221 | | |
191 | 222 | | |
192 | 223 | | |
| |||
200 | 231 | | |
201 | 232 | | |
202 | 233 | | |
203 | | - | |
| 234 | + | |
204 | 235 | | |
205 | 236 | | |
206 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
130 | 135 | | |
131 | 136 | | |
132 | 137 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | 138 | | |
140 | 139 | | |
141 | 140 | | |
| |||
149 | 148 | | |
150 | 149 | | |
151 | 150 | | |
152 | | - | |
| 151 | + | |
153 | 152 | | |
154 | 153 | | |
155 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
| 93 | + | |
| 94 | + | |
89 | 95 | | |
90 | 96 | | |
91 | 97 | | |
| |||
0 commit comments