-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
cmd/geth: Graceful shutdown if disk is full #22103
Conversation
Adding warnings of free disk space left and graceful shutdown when there is not enough space left.
Is this a replacement for #21884 ? |
Thanks for the work on it - but I think it would be better to do the changes in the old PR then - wondering why you opened a new one. Seems you know how to push to a existing PR. |
I don't think I can modify PR if I'm not the author of it? Do you mean pushing my changes to vyrwu:handle-full-disk ? |
Oh sorry - just saw that the other PR is not from you - you did everything good then. |
code formatting Co-authored-by: Martin Holst Swende <martin@swende.se>
changing free disk warn level; check free disk space once in a minute
cmd/utils/cmd.go
Outdated
if err := stack.Start(); err != nil { | ||
Fatalf("Error starting protocol stack: %v", err) | ||
} | ||
go func() { | ||
sigc := make(chan os.Signal, 1) | ||
signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM) | ||
defer signal.Stop(sigc) | ||
|
||
syncMode := *GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode) | ||
if chainID.Int64() == 1 && syncMode != downloader.FastSync { |
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.
It's the light
sync mode we want to make an exception for.
Still, I'm not 100% sure this is the best approach, I'll think about it.
Two comments from the triage:
|
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 turned out pretty neat in the end, thanks for working on it!
It appears to work fine on linux, would be neat to get this tested on Windows, Darwin and/or FreeBsd too.
And potentially if the datadir is mapped via some other filesystem, like an NFS mount.
I've tested it and it works fine on Windows, Darwin and NFS mount |
if you really want to help: test it yourself instead of asking for proof from someone that put in really good work into this feature - also not sure what kind of elaboration is needed here |
Adding warnings of free disk space left and graceful shutdown when there is not enough space left. This also adds a flag datadir.minfreedisk which can be used to set the trigger for low disk space, and setting it to zero disables the check. Co-authored-by: Martin Holst Swende <martin@swende.se> Co-authored-by: Felix Lange <fjl@twurst.com>
How low is low? Is it % or MB? Is it possible to adjust this setting? |
Adding warnings of low free disk space left and graceful shutdown when there is not enough space left.