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

dnsseed.dat is not updated on exit #76

Open
Sjors opened this issue Aug 19, 2019 · 1 comment
Open

dnsseed.dat is not updated on exit #76

Sjors opened this issue Aug 19, 2019 · 1 comment

Comments

@Sjors
Copy link
Contributor

Sjors commented Aug 19, 2019

ThreadDumper saves the database to dnsseed.dat every 3200 seconds (~1 hour). It would be nice if it also saved upon graceful exit.

@sipa
Copy link
Owner

sipa commented Aug 19, 2019

Yeah, that would be great.

melroy89 pushed a commit to BitcoinCash1/Bitcoin-Cash-Node that referenced this issue Oct 10, 2024
The app can now be exited in the usual unix ways (SIGTEM, SIGINT, etc).

The app now fully cleans itself up on exit, and dumps stats to disk
immediately on exit, as opposed to once per hour only (the once per
hour thing still occurs in the background as well, however).

This issue was also something Sipa wanted to fix, see here:
sipa/bitcoin-seeder#76

Note that the extant `ThreadDumper` has an issue when it is saving in
the background: sipa/bitcoin-seeder#108.

A side-effect of this commit is that when the app exits and it does the
final save to disk, no nodes will be lost from the DB, partially
resolving the above issue.

Summary of changes:

- All sleeping in the code (including poll/select) now periodically
  polls the newly-introduced "shutdown requested" flag.
- Added asynch-signal-safe handling of app shutdown signals (SIGINT,
  etc)
- On app signal, set the shutdown requested flag.
- ThreadCrawler socket select/poll now periodically wakes up to check
  the "shutdown requested" flag (this is to allow for fast thread exit
  from the crawler threads).
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

No branches or pull requests

2 participants