Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

[proposal] Allow graceful programmatic shutdown #1192

Closed
@dryajov

Description

@dryajov

It's currently not possible to programmatically do a graceful shutdown of ipfs daemons on windows through the use of signals, the way it's done on Unix like systems - due to windows lack of signal support. From Node.js documentation - https://nodejs.org/api/process.html#process_signal_events.

This is an issue for applications that try to interact with the daemons programmatically such as ipfsd-ctl, since sending a SIGINT to any process will not trigger a signal handler, but simply kill the process, which in turn leaves the repo locked and possibly in an inconsistent state.

One possible solution would be to add some sort of explicit shutdown command (ipfsd shutdown) - that would shutdown the daemon. So far, I think this can be implemented either as an additional HTTP endpoint or by the presence of a 0 byte file at the root of the repo:

i.e.

  • /api/v0/shutdown resource - when calling the endpoint, the daemon responds with a 200 or 202 HTTP response code and beggins the shutdown of the daemon
  • .jsipfs/shutdown file - the daemon monitors the repo for the presence of this file, if its there, it will delete the file and initiate the daemon shutdown

This is just a suggestion, and if there are better/cleaner ways of achieving this, I'd love to hear about them.

Note that anything we do here, would also have to be done in the go implementation, since it affects both daemon types - // cc - @whyrusleeping @lgierth @Stebalien

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions