-
Notifications
You must be signed in to change notification settings - Fork 21.6k
accounts, cmd/geth, core: close opened files #29598
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
accounts, cmd/geth, core: close opened files #29598
Conversation
| ks.mu.Lock() | ||
| defer ks.mu.Unlock() | ||
| if unl, found := ks.unlocked[addr]; found { | ||
| ks.mu.Unlock() |
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.
This changes the semantics. Previously, it released the lock before invoking ks.expire, but with your changes it retains the lock during the call.
Ostensibly, this was coded like it is for a reason. Please motivate why you consider this change safe/needed
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.
If you just want to remove some code, but retain the semantics, you could do
ks.mu.Lock()
unl, found := ks.unlocked[addr]
ks.mu.Unlock()
if found{
ks.expire(addr, unl, time.Duration(0)*time.Nanosecond)
}
return nil
cmd/utils/history_test.go
Outdated
| if err != nil { | ||
| t.Fatalf("error opening era file: %v", err) | ||
| } | ||
| defer f.Close() |
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.
This is a bit non-obvious,but era.From takes an io.ReadSeekCloser, and era.Close closes the f. So this change would make it a double-close
|
Please make a habit of always writing PR descriptions |
holiman
left a comment
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
* fix: open file used up but not closed * feat: more same case * feat: accept conversation
* fix: open file used up but not closed * feat: more same case * feat: accept conversation
No description provided.