fix nilpointer panic when decode addlitional item failed in restore#8563
fix nilpointer panic when decode addlitional item failed in restore#8563AlbeeSo wants to merge 2 commits intovmware-tanzu:mainfrom
Conversation
Signed-off-by: 司司 <suyashi.sys@alibaba-inc.com>
3060b6d to
b9525af
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8563 +/- ##
==========================================
+ Coverage 59.17% 59.18% +0.01%
==========================================
Files 370 370
Lines 39487 39493 +6
==========================================
+ Hits 23366 23375 +9
+ Misses 14647 14645 -2
+ Partials 1474 1473 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/kind changelog-not-required |
Signed-off-by: 司司 <suyashi.sys@alibaba-inc.com>
|
what is the scenario where this was actually hit? |
hi, sorry that i am still trying reproduce the problem as the testing k8s cluster has been deleted. |
|
I am not sure if it is right to continue the restore by just putting this in error. |
A hard failure is another choice, instead of the panic currently. |
|
If we are hitting this issue, it means that it is not a per item failure, but a code bug potentially. Either in native or 3P plugins. Hard failures can be caught in E2E tests much easily. |
|
@blackpiglet do you think my suggestion is aligned here? Or do you think current PR is better approach? |
|
I didn't give much think to this error-handling logic before. In this case, I'm still not sure which one is a better choice, skip the failed item or fail the restore. |
|
"is the JSON content gets corrupted during the network transferring." - that seems like a very particular scenario. Not sure if that's what happened in this case. |
Thank you for contributing to Velero!
Please add a summary of your change
When decode additional item in
restoreItemfailed,velero/pkg/restore/restore.go
Line 1390 in 78c97d9
may case nilpointer panic in the inner function (like GetName, for exmple, as the obj is nil actually)
velero/pkg/restore/restore.go
Line 1400 in 78c97d9
with messages like (I tested in velero 1.14, but the related logic is same with the latest):
so I guess the right way is to give up restoring and just throw errors.
Does your change fix a particular issue?
Fixes #(issue)
Please indicate you've done the following:
make new-changelog) or comment/kind changelog-not-requiredon this PR.site/content/docs/main.