Skip to content

fd leak and error handling#33713

Merged
aaronlehmann merged 1 commit into
moby:masterfrom
x1022as:error_fd
Jul 6, 2017
Merged

fd leak and error handling#33713
aaronlehmann merged 1 commit into
moby:masterfrom
x1022as:error_fd

Conversation

@x1022as

@x1022as x1022as commented Jun 16, 2017

Copy link
Copy Markdown
Contributor

Signed-off-by: Deng Guangxing [email protected]

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah changed the title fd leak and error hanlding fd leak and error handling Jun 16, 2017
Comment thread pkg/discovery/generator.go Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I feel like this should be run at package init.

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.

@cpuguy83 Can you explain explicitly? I'm afraid I did't get your point of package init :(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@x1022as Because this is effectively a package level constant.

@cpuguy83 cpuguy83 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does this one need an error check 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 think errors should be ignored and continue the for loop, so maybe no need to check here.

@x1022as

x1022as commented Jun 23, 2017

Copy link
Copy Markdown
Contributor Author

janky failed seems not related. will push again to re-run it.

Signed-off-by: Deng Guangxing <[email protected]>
@thaJeztah

Copy link
Copy Markdown
Member

ping @aaronlehmann PTAL

tmpOffset += s
}
r.Seek(tmpOffset+offset, os.SEEK_SET)
if _, err := r.Seek(tmpOffset+offset, os.SEEK_SET); err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Rather than calling Seek recursively here, which seems to do a lot of redundant work, couldn't we just set r.pos directly?

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.

ping @x1022as

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@aaronlehmann @vieux if this is an important fix, and we want it to be in 17.07, perhaps we should carry to make sure it gets merged in time

@aaronlehmann

Copy link
Copy Markdown

This LGTM as-is, however I suggested a simplification for the existing code. The simplification could happen in a separate PR.

@aaronlehmann
aaronlehmann merged commit 3be2273 into moby:master Jul 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants