{{ message }}
googlephotos: fix nil panic in Update when using async batch_mode#9502
Draft
davispw wants to merge 2 commits into
Draft
googlephotos: fix nil panic in Update when using async batch_mode#9502davispw wants to merge 2 commits into
davispw wants to merge 2 commits into
Conversation
db5fd80 to
544b2da
Compare
5 tasks
bc755d5 to
20a05c2
Compare
20a05c2 to
bb9b8d9
Compare
5 tasks
bb9b8d9 to
8be1491
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
When
batch_mode=asyncis configured,batcher.Commitreturns immediately with anil*api.MediaItemresult (the actual commit happens later in a background goroutine). The old code passed thisnildirectly too.setMetaData(info), which dereferenced it and panicked:This PR adds a defensive nil guard to
setMetaDataand updatesUpdateto use the local size when the API response is deferred, preventing the crash.Technical Details
setMetaData(info)to handle deferred results from async batcher commits.src.Size()foro.bytesinUpdatewheninfo == nil(so caching layers like thehasheroverlay can immediately record the correct fingerprint).Automated Tests
Adds the
TestAsyncBatchModePanicregression test inbackend/googlephotos/googlephotos_workaround_test.goverifying the fix under async mode.Manual Verification
Run an upload/overwrite in async mode:
Before the fix, this crashed immediately. After the fix, it succeeds without panic.
Dependencies (gh-stack)
This PR is independent and has no dependencies.
Was the change discussed in an issue or in the forum before?
As far as I know, this was not discussed previously.
Checklist