Commit 7473928
authored
[Xamarin.Android.Build.Tasks] Bump ZipFlushFilesLimit (#7957)
Context: https://dev.azure.com/DevDiv/DevDiv/_workitems/edit/1782014
Context: 9166e03
On Windows customers are seeing the following error:
error XABLD7000: Xamarin.Tools.Zip.ZipException: Renaming temporary file failed: Permission denied
at Xamarin.Tools.Zip.ZipArchive.Close() in /Users/runner/work/1/s/LibZipSharp/Xamarin.Tools.Zip/ZipArchive.cs:line 939
We have traced this to the use of the [`MoveFileExW()`][0] /
`MoveFileExA()` API: when libzip is trying to move its temp file to
the final location, Windows is raising this error:
Renaming temporary file failed: Permission denied
Turning off Anti Virus seems to help, however adding an exclusion
does not. This is very confusing, so we are unsure why this error is
being raised. The process has the correct permissions and the file
being moved is in the same directory, so its not a TEMP folder issue.
Perhaps it's the number of temp files we create? Part of the
`<BuildApk/>` system is that as we add files we `Flush()` the zip
file to commit those changes to disk. This is partly to work around
how libzip works: it does not write any data to the main file until
[`zip_close()`][1] is called. To work around issues around too many
files being open (9166e03), we added this flush.
The limit of 50 files was picked out of a hat. Try pushing the limit
up a bit to see if that helps.
Additionally, introduce the following two (private!) MSBuild
properties:
* `$(_ZipFlushFilesLimit)`: Call `Flush()` after
`$(_ZipFlushFilesLimit)` files have been added to the `.apk`.
* `$(_ZipFlushSizeLimit)`: Call `Flush()` after
`$(_ZipFlushSizeLimit)` bytes of data have been added to the
`.apk`.
[0]: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexw
[1]: https://libzip.org/documentation/zip_close.html1 parent 24affb5 commit 7473928
File tree
4 files changed
+89
-28
lines changed- src/Xamarin.Android.Build.Tasks
- Tasks
- Tests/Xamarin.Android.Build.Tests
- Utilities
4 files changed
+89
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
| |||
136 | 140 | | |
137 | 141 | | |
138 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
139 | 149 | | |
140 | 150 | | |
141 | 151 | | |
| |||
206 | 216 | | |
207 | 217 | | |
208 | 218 | | |
209 | | - | |
210 | 219 | | |
211 | 220 | | |
212 | 221 | | |
| |||
216 | 225 | | |
217 | 226 | | |
218 | 227 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
| 228 | + | |
225 | 229 | | |
226 | 230 | | |
227 | 231 | | |
| |||
236 | 240 | | |
237 | 241 | | |
238 | 242 | | |
239 | | - | |
240 | 243 | | |
241 | 244 | | |
242 | 245 | | |
| |||
278 | 281 | | |
279 | 282 | | |
280 | 283 | | |
281 | | - | |
| 284 | + | |
282 | 285 | | |
283 | 286 | | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | 287 | | |
290 | 288 | | |
291 | 289 | | |
| |||
377 | 375 | | |
378 | 376 | | |
379 | 377 | | |
380 | | - | |
381 | 378 | | |
382 | 379 | | |
383 | 380 | | |
| |||
398 | 395 | | |
399 | 396 | | |
400 | 397 | | |
401 | | - | |
402 | 398 | | |
403 | 399 | | |
404 | 400 | | |
| |||
482 | 478 | | |
483 | 479 | | |
484 | 480 | | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | 481 | | |
492 | 482 | | |
493 | 483 | | |
| |||
554 | 544 | | |
555 | 545 | | |
556 | 546 | | |
557 | | - | |
| 547 | + | |
558 | 548 | | |
559 | 549 | | |
560 | 550 | | |
| |||
578 | 568 | | |
579 | 569 | | |
580 | 570 | | |
581 | | - | |
| 571 | + | |
582 | 572 | | |
583 | 573 | | |
584 | 574 | | |
| |||
625 | 615 | | |
626 | 616 | | |
627 | 617 | | |
628 | | - | |
| 618 | + | |
629 | 619 | | |
630 | 620 | | |
631 | 621 | | |
| |||
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
962 | 962 | | |
963 | 963 | | |
964 | 964 | | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
965 | 1005 | | |
966 | 1006 | | |
967 | 1007 | | |
| |||
Lines changed: 30 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
68 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
69 | 96 | | |
70 | 97 | | |
71 | 98 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2152 | 2152 | | |
2153 | 2153 | | |
2154 | 2154 | | |
| 2155 | + | |
| 2156 | + | |
2155 | 2157 | | |
2156 | 2158 | | |
2157 | 2159 | | |
| |||
2185 | 2187 | | |
2186 | 2188 | | |
2187 | 2189 | | |
| 2190 | + | |
| 2191 | + | |
2188 | 2192 | | |
2189 | 2193 | | |
2190 | 2194 | | |
| |||
0 commit comments