contrib: Current systemd usage doesn’t allow for dependencies #21322

issue laanwj openend this issue on March 1, 2021
  1. laanwj commented at 8:37 am on March 1, 2021: member

    The current systemd service does not allow gracefully for services to depend on bitcoind. All dependent units will be launched immediately, regardless of current status. So if it is to work at all, they need an inefficient polling loop.

    In the service file the service type is specified as Type=forking but we don’t heed the behavior specified. From the systemd.service(5) man page:

    If set to forking, it is expected that the process configured with ExecStart= will call fork() as part of its start-up. The parent process is expected to exit when start-up is complete and all communication channels are set up.

    A possible solution is #21007, which adds -daemonwait so that the control is only returned to the parent process when startup is complete. In combination with Type=forking, I think this achieves the proper functionality: to start dependent units only when RPC functionality is working.

    With that the only change to the service file needed would be to use -daemonwait instead of -daemon.

    An alternative would be to implement support for Type=notify and do readyness notification through sd_notify. But I opted for daemonwait because it seems more generally useful. The advantage of using a native notification mechanism, however, would be that it is still possible to have logging through stdout to the journal. The drawback that it introduces an optional dependency on libsystemd.

  2. laanwj added the label Feature on Mar 1, 2021
  3. laanwj added the label Scripts and tools on Mar 1, 2021
  4. hebasto commented at 6:29 pm on March 1, 2021: member
    My vote is for #21007 as a solution. It is good to do not introduce new dependencies, even they are optional.
  5. laanwj referenced this in commit 8f249cba41 on Mar 11, 2021
  6. laanwj referenced this in commit 663f6cd9dd on Mar 22, 2021
  7. laanwj closed this on Mar 22, 2021

  8. laanwj referenced this in commit c46f1ce751 on Mar 22, 2021
  9. DrahtBot locked this on Aug 18, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-06 16:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me