Repository navigation
Commit 620228b
fix(apple): key the toolchain fingerprint memo on the resolved xcode-select dir (#3726)
* fix(apple): key the toolchain fingerprint memo on the resolved xcode-select dir
`toolchainFingerprintCacheKey` keyed the memo on `DEVELOPER_DIR` alone, so every default
`xcode-select` selection shared one entry. A daemon that answered a cache decision before
someone ran `sudo xcode-select -s` kept answering with the Xcode the host had left, and
because every hit re-set the entry, a busy daemon served it indefinitely rather than for one
TTL (#3300).
- Resolve the default selection per read and key on it, keeping a client's `DEVELOPER_DIR`
choice as before.
- Run that resolution under the probe clock and cancellation, capped below the probes it
precedes. A read that cannot resolve its selection skips the memo: a key shared by every
unresolved selection would let one host selection answer for the next.
- Measure the TTL from the read that stored an entry; a hit no longer extends it.
- Keep the report path probe-free by looking entries up under the dir the read that stored
one resolved.
Related: #3449, whose Xcode-too-old reports should name the toolchain a decision actually read.
* fix(apple): point the runner failure report at the selection a hit resolved
A default-selection read that hit the memo returned before updating the report pointer, so
after `xcode-select` moved A to B and back to A, a failure report named B for an A-backed
runner. Route the read and the hit through one memo lookup so both record the dir the read
resolved, and say so in that pointer's comment. Also drop "or skip" from the value-probe
guard's comment: that guard only ever throws.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* fix(apple): say what a runner failure report guarantees about its entry
The recorded selection outlives the entry it names: the memo's TTL is measured from the read
that stored the entry, so a report can look it up after that entry is gone. Say that, and pin
the case with a test that a report then names no Xcode rather than another selection's.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* fix(apple): key the runner toolchain memo on the selection's real dir
The reviewer's xcodes case: a tool swaps the Xcode bundle behind a stable path, so
`xcode-select -p` answers the same string and the key never moves. Resolve the host's
selection link to the dir it really names, and follow the same path for a client's
DEVELOPER_DIR so one toolchain lands on one entry. The link is read first, so a warm
read costs no spawn; `xcode-select -p` is the fallback.
Restore TTL renewal on a hit, which #3300 asked to keep: the key now moves with the
selection, so a hit is evidence the entry still answers for this host.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* fix(apple): key the runner toolchain memo on the bundle standing in the dir
A hit renews its entry, so a key that sees only the dir pins a stale fingerprint for as
long as a daemon stays busy when an update replaces the bundle in place: an installer or
App Store update at /Applications/Xcode.app keeps the path. Add the inode and mtime of the
version file xcodebuild reads to the key, so the replaced bundle answers under a new key
and the old entry expires once nothing renews it.
The failure report now reads only the memo. It reused the key halves a real read built
instead of resolving and stating the selection itself, which is what lets a hit renew at
all: a report has no budget to spend and no deadline to answer to. Cancellation is observed
after the key's two filesystem reads, so a warm hit cannot hide an abort.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* refactor(apple): own the selection link path beside the probe ceiling
The reviewer's nit: it was exported only so the suite could match it. It belongs with the
other Apple toolchain probe constant both probers read, where it can be named without that.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* fix(apple): keep each client's toolchain answer for its own failure report
One global record meant the last client-named DEVELOPER_DIR read erased what an
earlier client needed to report on, even while that client's fingerprint was
still cached. A daemon serves request-scoped selections concurrently, so retain
the answer per name instead. It is a TTL memo, so a name whose reads stopped
drops out on the same clock as the entry it names.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* test(apple): pin the replacement bundle's mtime so the key must move
The in-place replacement case relied on the filesystem to make both halves of
the memo key differ. On ext4 or tmpfs a freed inode is reused and two writes can
land in one truncated millisecond, leaving the key untouched and the case red.
Set the replacement's mtime explicitly. Also drop the claim that two probers
read the selection link path; only the toolchain probe does.
---------
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>1 parent f6fc99f commit 620228b
5 files changed
Lines changed: 980 additions & 84 deletions
File tree
- packages/platform-apple/src/runner
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | | - | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
12 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
13 | 25 | | |
14 | 26 | | |
15 | 27 | | |
| |||
27 | 39 | | |
28 | 40 | | |
29 | 41 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
33 | 46 | | |
34 | 47 | | |
| 48 | + | |
35 | 49 | | |
36 | 50 | | |
37 | 51 | | |
38 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
39 | 56 | | |
40 | 57 | | |
41 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 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 | + | |
| 96 | + | |
| 97 | + | |
| 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 | + | |
| 130 | + | |
| 131 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
272 | 276 | | |
273 | 277 | | |
274 | 278 | | |
275 | | - | |
| 279 | + | |
276 | 280 | | |
277 | 281 | | |
278 | 282 | | |
| |||
292 | 296 | | |
293 | 297 | | |
294 | 298 | | |
295 | | - | |
| 299 | + | |
296 | 300 | | |
297 | 301 | | |
| 302 | + | |
298 | 303 | | |
299 | 304 | | |
300 | 305 | | |
| |||
303 | 308 | | |
304 | 309 | | |
305 | 310 | | |
306 | | - | |
| 311 | + | |
307 | 312 | | |
308 | | - | |
| 313 | + | |
309 | 314 | | |
310 | 315 | | |
311 | 316 | | |
312 | 317 | | |
313 | | - | |
| 318 | + | |
314 | 319 | | |
315 | 320 | | |
316 | 321 | | |
| |||
439 | 444 | | |
440 | 445 | | |
441 | 446 | | |
442 | | - | |
| 447 | + | |
443 | 448 | | |
444 | 449 | | |
445 | 450 | | |
| |||
449 | 454 | | |
450 | 455 | | |
451 | 456 | | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
452 | 460 | | |
453 | 461 | | |
454 | 462 | | |
| |||
513 | 521 | | |
514 | 522 | | |
515 | 523 | | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | 524 | | |
555 | 525 | | |
556 | 526 | | |
| |||
652 | 622 | | |
653 | 623 | | |
654 | 624 | | |
655 | | - | |
656 | 625 | | |
657 | 626 | | |
| 627 | + | |
658 | 628 | | |
659 | 629 | | |
660 | 630 | | |
661 | 631 | | |
662 | | - | |
663 | | - | |
664 | | - | |
| 632 | + | |
665 | 633 | | |
666 | 634 | | |
667 | 635 | | |
| |||
681 | 649 | | |
682 | 650 | | |
683 | 651 | | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
| 652 | + | |
689 | 653 | | |
690 | 654 | | |
691 | 655 | | |
692 | | - | |
| 656 | + | |
693 | 657 | | |
694 | 658 | | |
695 | 659 | | |
| |||
793 | 757 | | |
794 | 758 | | |
795 | 759 | | |
796 | | - | |
| 760 | + | |
797 | 761 | | |
798 | 762 | | |
799 | | - | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
800 | 796 | | |
801 | 797 | | |
802 | 798 | | |
803 | 799 | | |
804 | 800 | | |
805 | 801 | | |
806 | 802 | | |
807 | | - | |
808 | | - | |
809 | | - | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
810 | 808 | | |
811 | 809 | | |
812 | 810 | | |
813 | 811 | | |
814 | 812 | | |
815 | | - | |
| 813 | + | |
816 | 814 | | |
817 | 815 | | |
818 | 816 | | |
| |||
0 commit comments