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

FIX: Open File leak #647

Merged
merged 10 commits into from
Dec 9, 2020
Merged

FIX: Open File leak #647

merged 10 commits into from
Dec 9, 2020

Conversation

kellrott
Copy link
Contributor

Under some deployments (local backend, but possibly others) GRPC event writers weren't closed, and so the system leaked open file handles, until it ran out under the ulimit -n constraint. This PR adds Close methods to several interfaces so that network connections and open files are closed.

@kellrott kellrott requested a review from bwalsh November 17, 2020 17:52
@kellrott
Copy link
Contributor Author

I've checked and the pbs unit test is also happening to master. Something has changed to the docker build within the past 8 months and now the script submitted to the pbs queue in the docker container doesn't has permission to use docker (but if you exec into the container it can). This comes back as an execution error in the unit test.
I'd prefer to fix it in an other PR, rather then delay this one while trying to figure out a fix.

Copy link
Member

@bwalsh bwalsh left a comment

Choose a reason for hiding this comment

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

Minor comments

@@ -47,7 +47,7 @@ type Server struct {
// Database represents the base funnel database interface
type Database interface {
tes.ReadOnlyServer
events.Writer
//events.Writer
Copy link
Member

Choose a reason for hiding this comment

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

Why commented? Remove, or add comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@@ -55,6 +55,10 @@ func (b *HPCBackend) WriteEvent(ctx context.Context, ev *events.Event) error {
return nil
}

func (b *HPCBackend) Close() {
//TODO: Close things here?
Copy link
Member

Choose a reason for hiding this comment

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

If really a TODO, add test ... If a NOOP, add comment to say so

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed comment

@@ -47,3 +47,7 @@ func NewDynamoDB(conf config.DynamoDB) (*DynamoDB, error) {
func (db *DynamoDB) Init() error {
return db.createTables()
}

func (db *DynamoDB) Close() {
//db.client.Close()
Copy link
Member

Choose a reason for hiding this comment

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

Why commented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was there from dev, when assumed there was a dynamo close method. There doesn't appear to be one, so the comment has been removed.

@kellrott kellrott merged commit ec43c89 into master Dec 9, 2020
@lbeckman314 lbeckman314 deleted the close-files branch October 1, 2024 01:05
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.

2 participants