Skip to content
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

Extend driver.ListLayers() #1563

Merged
merged 1 commit into from
Apr 13, 2023
Merged

Extend driver.ListLayers() #1563

merged 1 commit into from
Apr 13, 2023

Conversation

nalind
Copy link
Member

@nalind nalind commented Apr 10, 2023

  • Implement ListLayers() for the aufs, btrfs, and devicemapper drivers, along with a unit test for them.
  • Stop filtering out directories with names that aren't 64-hex chars the overlay and vfs ListLayers() implementations, which is more a convention than a hard rule.
  • Close() a dangling ReadCloser in NaiveCreateFromTemplate.
  • Have layerStore.Wipe() try to remove remaining listed layers after it removes the layers that the layerStore knew of.
  • Switch from using plain defer to using t.Cleanup() to handle deleting layers that tests create, have the addManyLayers() test function do so as well.
  • Remove vfs.CopyDir, which near as I can tell isn't referenced anywhere.

@nalind nalind force-pushed the listlayers branch 2 times, most recently from ee6092a to 922af86 Compare April 10, 2023 14:14
@rhatdan
Copy link
Member

rhatdan commented Apr 10, 2023

@nalind nalind force-pushed the listlayers branch 4 times, most recently from f4d8893 to 1166982 Compare April 10, 2023 21:01
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@giuseppe
Copy link
Member

the test failure seems related to the PR

@nalind nalind force-pushed the listlayers branch 3 times, most recently from 6ca0e65 to 972f7c7 Compare April 11, 2023 18:01
Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Just a very minimal pass over the driver changes — I don’t understand the subtleties of the graph drivers, and I didn’t carefully read the graph test parts.

drivers/overlay/overlay.go Outdated Show resolved Hide resolved
@nalind nalind force-pushed the listlayers branch 9 times, most recently from e702ebc to abb0f09 Compare April 12, 2023 17:45
// error is returned
func removeLayer(t testing.TB, driver graphdriver.Driver, name string) {
err := driver.Remove(name)
for i := 100 * time.Millisecond; i <= 1000*time.Millisecond && err != nil && errors.Is(err, syscall.EBUSY); i += (100 * time.Millisecond) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

(I’m totally unfamiliar with this) BTW is it understood why retries are necessary? I’d naively expect the tests to be one of the more deterministic environments with no unexpected concurrent accessors, so what is keeping the volume busy if it’s not the tests?

Are the tests somehow triggering hard-to-cleanup concurrent goroutines/threads/processes that they don’t wait for, maybe?

Copy link
Collaborator

Choose a reason for hiding this comment

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

And if it is understood, it might be worth documenting somewhere around here.

Copy link
Member Author

Choose a reason for hiding this comment

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

In isolated testing, I'd occasionally see the devicemapper driver returning EBUSY when we tried to remove layers, though this may have only been happening when deferred deletion wasn't being used. I'll see what happens if I remove that logic, and just have this helper expect success.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There’s enough mentions of EBUSY throughout the codebase that I totally believe that there’s something (or multiple somethings) going on — I just could never find any specific description of what is actually the reason. The closest is #719 / moby/moby#36438 , which also isn’t really specific (and seems to suggest that the error is a genuine external user, not something that could be successfully retried).

So I’m mostly trying to get as much of the knowledge, if any, documented and explicit.
If this is working as designed and just requires a retry for good reasons, great, let’s document that.
If we know what is not working as designed, but needs a workaround short-term, fine, let’s document that.
If the cause is unknown but we know that something is failing, oh well, documenting that would still be nice.

If we are lucky, somebody will, sometime, find and fix the cause, and then look at this kind of loop and wonder whether it can be removed — and documenting why it was added would have been helpful.

Implement ListLayers() for the aufs, btrfs, and devicemapper drivers,
along with a unit test for them.
Stop filtering out directories with names that aren't 64-hex chars in
vfs and overlay ListLayers() implementations, which is more a convention
than a hard rule.
Have layerStore.Wipe() try to remove remaining listed layers after it
removes the layers that the layerStore knew of.
Close() a dangling ReadCloser in NaiveCreateFromTemplate.
Switch from using plain defer to using t.Cleanup() to handle deleting
layers that tests create, have the addManyLayers() test function do so
as well.
Remove vfs.CopyDir, which near as I can tell isn't referenced anywhere.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
@rhatdan
Copy link
Member

rhatdan commented Apr 13, 2023

/approve
/lgtm

@rhatdan rhatdan merged commit 21aca29 into containers:main Apr 13, 2023
18 checks passed
@nalind nalind deleted the listlayers branch April 13, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants