Skip to content

Repro stashed upload blob issue when processing reuploaded blob#22981

Merged
dannimad merged 8 commits into
microsoft:mainfrom
dannimad:tombstoneblobs
Nov 11, 2024
Merged

Repro stashed upload blob issue when processing reuploaded blob#22981
dannimad merged 8 commits into
microsoft:mainfrom
dannimad:tombstoneblobs

Conversation

@dannimad
Copy link
Copy Markdown
Contributor

@dannimad dannimad commented Nov 5, 2024

This is a test repro of AB#4630.
To reproduce such issue, I had to fake the localId generation using uuidOverride constructor method in the blob manager so we could aim at a unique pending blob: such pending blob was: 1 stashed, 2 reapplied to a different blob manager simulating rehydration, 3 processed and 4 reuploaded by stashing workflow, which ends up in the issue described in the ADO item.
In order to wait for the reupload I had to create a different blob manager method waitForStashedBlobs() since the one we have hasPendingStashedUploads() uses pendingBlobs array as reference, which blob entry would be removed by the processing step.
A fix will follow up this PR.

@github-actions github-actions Bot added area: runtime Runtime related issues base: main PRs targeted against main branch labels Nov 5, 2024
Comment thread packages/runtime/container-runtime/src/blobManager/blobManager.ts
Comment thread packages/runtime/container-runtime/src/blobManager/blobManager.ts Outdated
Copy link
Copy Markdown
Collaborator

@msfluid-bot msfluid-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Coverage Summary

↑ packages.runtime.container-runtime.src.blobManager:
Line Coverage Change: 0.02%    Branch Coverage Change: 0.14%
Metric NameBaseline coveragePR coverageCoverage Diff
Branch Coverage 96.66% 96.80% ↑ 0.14%
Line Coverage 99.14% 99.16% ↑ 0.02%

Baseline commit: 3c27751
Baseline build: 305767
Happy Coding!!

Code coverage comparison check passed!!

@msfluid-bot
Copy link
Copy Markdown
Collaborator

msfluid-bot commented Nov 5, 2024

@fluid-example/bundle-size-tests: +2.22 KB
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 463.74 KB 464.27 KB +542 Bytes
azureClient.js 562.69 KB 563.23 KB +556 Bytes
connectionState.js 724 Bytes 724 Bytes No change
containerRuntime.js 261.99 KB 262.5 KB +521 Bytes
fluidFramework.js 426.65 KB 426.66 KB +14 Bytes
loader.js 134.18 KB 134.19 KB +14 Bytes
map.js 42.71 KB 42.71 KB +7 Bytes
matrix.js 148.32 KB 148.33 KB +7 Bytes
odspClient.js 528.43 KB 528.97 KB +556 Bytes
odspDriver.js 97.84 KB 97.86 KB +21 Bytes
odspPrefetchSnapshot.js 42.81 KB 42.83 KB +14 Bytes
sharedString.js 164.17 KB 164.17 KB +7 Bytes
sharedTree.js 417.11 KB 417.11 KB +7 Bytes
Total Size 3.36 MB 3.37 MB +2.22 KB

Baseline commit: 3c27751

Generated by 🚫 dangerJS against 573ba64

Comment thread packages/runtime/container-runtime/src/blobManager/blobManager.ts Outdated
Comment thread packages/runtime/container-runtime/src/blobManager/blobManager.ts Outdated
Comment thread packages/runtime/container-runtime/src/blobManager/blobManager.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 suggestions.

Comments skipped due to low confidence (1)

packages/runtime/container-runtime/src/test/blobManager.stashed.spec.ts:159

  • The line contains a syntax error. The 'await' keyword should not be used with 'let'. It should be 'await letUploadsComplete;'.
await letUploadsComplete.promise;

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

Comment thread packages/runtime/container-runtime/src/blobManager/blobManager.ts Outdated
Comment thread packages/runtime/container-runtime/src/blobManager/blobManager.ts Outdated
private readonly localBlobIdGenerator: () => string;
private readonly pendingStashedBlobs: Map<string, Promise<ICreateBlobResponse | void>> =
new Map();
private stashedBlobsUploadP: Promise<(void | ICreateBlobResponse)[]> | undefined = undefined;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit. this could be a lazy promise, which would make the method simpler, and allow this to be immutable (readonly)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could also embed the clear into the lazy promise as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take this nit into consideration on a follow up PR

@dannimad dannimad closed this Nov 11, 2024
@dannimad dannimad reopened this Nov 11, 2024
@dannimad dannimad enabled auto-merge (squash) November 11, 2024 18:05
@dannimad dannimad merged commit f3eeaf1 into microsoft:main Nov 11, 2024
@dannimad dannimad deleted the tombstoneblobs branch November 11, 2024 21:52
dannimad added a commit that referenced this pull request Nov 15, 2024
This change fixes issue covered in PR
#22981
After several simplifications, I realized we could reuse
pendingStashedBlobs map to identify the bug scenario, which is
reuploading a stashed blob that was already processed. If while
onUploadResolve we don't see the blob in the pending list but it's on
the stashed one, then just ignore the new upload.
trackPendingStashedUploads is replaced with waitForStashedBlobs which
also implies there are further simplifications to the blob manager
logic, mainly we could also remove the stashedUpload property on the
PendingBlob type since now we keep track of stashed blobs separately .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Runtime related issues base: main PRs targeted against main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants