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

quit nicely with bitcoin-cli stop; use simple mode #14442

Closed
wants to merge 1 commit into from

Conversation

SmartLayer
Copy link

  • stop bitcoind with bitcoin-cli stop
    (as I Googled around it seem to be the neater way to stop bitcoind)

  • Put bitcoind to the foreground - Supervision services like systemd usually prefer daemons to be running in the foreground.

Tested on my production server, Debian 9.5.

@ch4ot1c
Copy link
Contributor

ch4ot1c commented Oct 9, 2018

I also had issues stopping/restarting with the prior version, so this is a welcome commit. Was on Debian as well (Raspbian Stretch Lite, Pi3).

Working better - restarted successfully!

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 9, 2018

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #12255 (Update bitcoin.service to conform to init.md by dongcarl)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@fanquake
Copy link
Member

@dongcarl can you comment on how this overlaps with #12255

@dongcarl
Copy link
Contributor

@fanquake It seems somewhat orthogonal to what I was doing in #12255, this commit seems to want to have systemd handle the daemonizing of bitcoind, whereas my change explicitly configures the pid file location such that systemd has a way to reach bitcoind. I am fine with either approach, and will rebase my commit sometime.

@promag
Copy link
Member

promag commented Nov 4, 2018

Can't test ATM, what happens when you try to stop or restart if service is already stopped?

@dongcarl
Copy link
Contributor

dongcarl commented Nov 4, 2018

@promag I believe since systemd handles the daemonizing of bitcoind, if bitcoind is stopped directly (through bitcoin-cli or via a kill signal), the systemd service will also be stopped.

Copy link
Contributor

@dongcarl dongcarl left a comment

Choose a reason for hiding this comment

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

@colourful-land Upon re-looking at this PR, I'm not sure that we should be stopping the node with bitcoin-cli stop.

If you look at the Shutdown section of init.cpp here:

bitcoin/src/init.cpp

Lines 102 to 104 in e77a225

// A clean exit happens when StartShutdown() or the SIGTERM
// signal handler sets ShutdownRequested(), which makes main thread's
// WaitForShutdown() interrupts the thread group.

It seems that SIGTERM is sufficient, and that is the default KillSignal according to systemd.kill. I would specify it explicitly, but that's not entirely necessary.

Not running bitcoind in daemon mode could be helpful, and I would explicitly add printtoconsole so that logs are available from journald.

@laanwj
Copy link
Member

laanwj commented Jan 2, 2019

It should be unnecessary if SIGTERM is currently used, as SIGTERM does exactly the same as bitcoin-cli stop

@dongcarl
Copy link
Contributor

dongcarl commented Jan 5, 2019

For the "use simple mode" part of this PR, see here (#12255 (comment)) for why it's not a good idea.

@fanquake
Copy link
Member

fanquake commented Jan 5, 2019

Closing for now, due to comments here as well as in #12255.

@fanquake fanquake closed this Jan 5, 2019
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants