Commit 6f218b3
fix(driver-utils): prevent unhandled rejection in getSnapshotTree prefetch (#26173)
## Summary
- Fix unhandled promise rejections in `PrefetchDocumentStorageService`
fire-and-forget calls
- Add unit test for getSnapshotTree failure scenario
## Problem
This is a follow-up to PR #26151. After that fix was deployed, telemetry
showed 349 `uncaughtException` errors from
`ShreddedSummaryDocumentStorageService.readBlob` in test-service-load
tinylicious tests.
**Root cause:** PR #26151 attached `.catch()` to the inner promise in
`cachedRead()`, but that only handles ONE promise chain. The
fire-and-forget callers create a DIFFERENT chain:
1. **`void this.cachedRead(blob)`** - `cachedRead` is async, so it
returns a NEW promise wrapping the inner promise. The `.catch()` on the
inner promise doesn't prevent unhandled rejection on the async
function's returned promise.
2. **`void p.then(...)`** in `getSnapshotTree()` - creates a derived
promise that also rejects when `p` rejects.
## Solution
Fix all three fire-and-forget patterns:
```typescript
// Before (inner promise handled, but async wrapper not):
void this.cachedRead(blob);
// After (handles the async function's returned promise):
this.cachedRead(blob).catch(() => {});
```
```typescript
// Before (derived promise not handled):
void p.then((tree) => this.prefetchTree(tree));
// After (handles the derived promise):
void p.then(...).catch(() => {});
```
## Test plan
- [x] New unit test for `getSnapshotTree` failure scenario
- [x] All 5 PrefetchDocumentStorageService tests pass
- [x] Build passes
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: anthony-murphy <anthony.murphy@microsoft.com>
---------
Co-authored-by: anthony-murphy-agent <253562292+anthony-murphy-agent@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: anthony-murphy <anthony.murphy@microsoft.com>1 parent 6b203f0 commit 6f218b3
File tree
2 files changed
+41
-6
lines changed- packages/loader/driver-utils/src
- test
2 files changed
+41
-6
lines changedLines changed: 13 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| 43 | + | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| |||
81 | 86 | | |
82 | 87 | | |
83 | 88 | | |
84 | | - | |
85 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
89 | 95 | | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
93 | | - | |
94 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
95 | 102 | | |
96 | 103 | | |
97 | 104 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
| |||
160 | 165 | | |
161 | 166 | | |
162 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
163 | 191 | | |
0 commit comments