-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cache: fix null pointer access when cachemanager.Disable is true #536
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #536 +/- ##
==========================================
- Coverage 33.56% 33.56% -0.01%
==========================================
Files 65 65
Lines 8175 8176 +1
==========================================
Hits 2744 2744
- Misses 5116 5117 +1
Partials 315 315
|
Why not check if the cacheMgr is nil? |
@@ -37,6 +37,7 @@ type Manager struct { | |||
} | |||
|
|||
type Opt struct { | |||
Disabled bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Maybe also update these config.toml
:
- misc/snapshotter/config.toml
- tests/e2e/k8s/snapshotter-cri.yaml
- tests/e2e/k8s/snapshotter-kubeconf.yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cache_manager.disable
is still set to be false
for those three files. I'm keeping the configuration item for compatibility though it doesn't take effect. Not sure whether cache_manager.disable
will be used to control auto garbage collect
in future or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a second thought, I think we can support recyclebin
to keep deleted files for a while. Those configuration item can be used for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introducing recyclebin seems to add complexity and doesn't feel necessary, it is better to let kubelet & containerd control the GC policy.
With the evolution of nydus-snapshotter, |
Filesystem.cacheMgr is null when cacheManager.Disable is configured to be true, thus cause null pointer access. Fix it by always create the cacheMgr object no matter cacheManager.Disable is true or false. Signed-off-by: Jiang Liu <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Filesystem.cacheMgr is null when cacheManager.Disable is configured to be true, thus cause null pointer access. Fix it by always create the cacheMgr object no matter cacheManager.Disable is true or false.