Commit e7ac602
committed
Fix OSS RE client: FindMissingCache staleness, TTL, and silent upload skip
Three related bugs in the OSS RE gRPC client cause `remote_upload_error`
when deferred-materialized outputs from one action are used as inputs to
another action.
**Bug 1: Hardcoded TTL of 0 in OSS shim**
`convert_action_result()` hardcodes `ttl: 0` for all output files and
`action_result_ttl: 0` for execute responses. The standard REv2 protocol
has no TTL field — TTL is a buck2 extension. With ttl=0, the deferred
materializer treats every blob as immediately expired, so
`get_digests_ttl()` always queries FindMissingBlobs instead of trusting
that recently-produced outputs still exist.
Fix: use `cas_ttl_secs` from runtime options (configured via
`cas_ttl_secs` buckconfig key, default 3 hours) instead of hardcoding 0.
**Bug 2: FindMissingCache caches "Missing" state**
`get_digests_ttl()` caches `DigestRemoteState::Missing` in the
FindMissingCache LRU (500K entries, 12-hour TTL). "Missing" is a
transient state — the blob may be uploaded or produced by an RE action
at any time. A stale "Missing" entry causes `get_digests_ttl()` to
return ttl=0 without sending a FindMissingBlobs RPC, even though the
blob now exists in CAS. Since deferred materialization never downloaded
the blob, buck2 cannot upload it and fails with `remote_upload_error`.
Fix: stop caching `DigestRemoteState::Missing`. Only cache
`ExistsOnRemote`. Additionally, mark top-level output file and directory
digests as `ExistsOnRemote` when processing action results from Execute,
GetActionResult, and WriteActionResult responses.
**Bug 3: Silent skip of missing CAS artifacts during upload**
When the uploader encounters a `RequiresCasDownload` file that
FindMissingBlobs reports as missing, it logs a `soft_error!("cas_missing")`
and silently skips the file (`continue`). The downstream action then
fails with incomplete inputs.
Fix: instead of silently skipping, materialize the file locally (which
downloads from CAS, bypassing FindMissingCache) and add it to the upload
list. If CAS truly doesn't have the blob, `ensure_materialized` fails
with a clear error instead of a mysterious downstream action failure.1 parent 442a1d6 commit e7ac602
File tree
2 files changed
+63
-16
lines changed- app/buck2_execute/src/re
- remote_execution/oss/re_grpc/src
2 files changed
+63
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| 315 | + | |
315 | 316 | | |
316 | 317 | | |
317 | | - | |
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
364 | 377 | | |
365 | 378 | | |
366 | 379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
594 | | - | |
| 594 | + | |
595 | 595 | | |
596 | 596 | | |
597 | 597 | | |
| |||
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
672 | | - | |
| 672 | + | |
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
676 | | - | |
| 676 | + | |
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
| |||
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
700 | 703 | | |
701 | | - | |
702 | | - | |
| 704 | + | |
| 705 | + | |
703 | 706 | | |
704 | 707 | | |
705 | 708 | | |
| |||
724 | 727 | | |
725 | 728 | | |
726 | 729 | | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
727 | 733 | | |
728 | | - | |
729 | | - | |
| 734 | + | |
| 735 | + | |
730 | 736 | | |
731 | 737 | | |
732 | 738 | | |
| |||
756 | 762 | | |
757 | 763 | | |
758 | 764 | | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
759 | 768 | | |
760 | 769 | | |
761 | 770 | | |
| |||
765 | 774 | | |
766 | 775 | | |
767 | 776 | | |
768 | | - | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
769 | 780 | | |
770 | 781 | | |
771 | 782 | | |
| |||
794 | 805 | | |
795 | 806 | | |
796 | 807 | | |
797 | | - | |
| 808 | + | |
| 809 | + | |
798 | 810 | | |
799 | 811 | | |
800 | 812 | | |
801 | 813 | | |
802 | | - | |
| 814 | + | |
803 | 815 | | |
804 | 816 | | |
805 | 817 | | |
| |||
837 | 849 | | |
838 | 850 | | |
839 | 851 | | |
| 852 | + | |
840 | 853 | | |
841 | 854 | | |
842 | 855 | | |
| |||
1019 | 1032 | | |
1020 | 1033 | | |
1021 | 1034 | | |
1022 | | - | |
1023 | | - | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
1024 | 1041 | | |
1025 | | - | |
1026 | 1042 | | |
1027 | 1043 | | |
1028 | 1044 | | |
| |||
1080 | 1096 | | |
1081 | 1097 | | |
1082 | 1098 | | |
1083 | | - | |
| 1099 | + | |
1084 | 1100 | | |
1085 | 1101 | | |
1086 | 1102 | | |
| |||
1097 | 1113 | | |
1098 | 1114 | | |
1099 | 1115 | | |
1100 | | - | |
| 1116 | + | |
1101 | 1117 | | |
1102 | 1118 | | |
1103 | 1119 | | |
| |||
1176 | 1192 | | |
1177 | 1193 | | |
1178 | 1194 | | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
1179 | 1213 | | |
1180 | 1214 | | |
1181 | 1215 | | |
| |||
0 commit comments