Skip to content

Consider always running the monitor process #5786

Closed

Description

@calmh

The monitor process handles multiple different concerns:

  • Restarts, in that the main syncthing process can exit with a certain exit code and get restarted
  • Crashes, in that the main syncthing process will get restarted
  • Crash reporting, both storing the crash from above and sending it to the mothership when enabled.

If the restart behavior is undesired the monitor process can be disabled by env var or startup switch.

However, we could just always use the monitor process for crash tracking and when given one of the flags as above exit afterwards, letting whoever is monitoring us see the restart happening.

Activity

  1. added
    enhancement
    on Jun 11, 2019
  2. AudriusButkevicius commented on Jun 11, 2019

    @AudriusButkevicius
    Member

    It breaks killing the proccess tho, as in most cases the child will get disowned.

  3. imsodin commented on Jun 11, 2019

    @imsodin
    Member

    Not if the monitor handles signals and terminates the child correctly (except SIGKILL, but when you use that you asked for it). It already does that today I think.

  4. calmh commented on Jun 11, 2019

    @calmh
    MemberAuthor

    We handle a normal (soft) kill correctly. For a SIGKILL, yeah, you need to target all the processes. (Or the process group that we set up.)

  5. AudriusButkevicius commented on Jun 11, 2019

    @AudriusButkevicius
    Member

    I know for a fact android uses sigkill after some time, and having runaway processes there would be terrible as they would kill the battery. There is prctl P_DEATHSIG on linux tho, or we could just poll for ppid/some pipe being open and blow up when it changes.

  6. calmh commented on Jun 12, 2019

    @calmh
    MemberAuthor

    Why do you think Android would only send sigkill to the monitor process, if this is something it does to kill off background things and save battery? But even if that's the case, then Android can be a special case and run without monitor...

  7. AudriusButkevicius commented on Jun 12, 2019

    @AudriusButkevicius
    Member

    Android wrapper sends term, if that doesn't exit in 10s, then sends a kill.

  8. canton7 commented on Jun 12, 2019

    @canton7
    Contributor

    The reason that SyncTrayzor doesn't use the monitor process is upgrades. When Syncthing upgrades itself, the monitor process spawns the new version of the monitor process and then exits. SyncTrayzor then loses control of the monitor process.

    I'm good with anything so long as this problem isn't re-introduced.

  9. calmh commented on Jun 12, 2019

    @calmh
    MemberAuthor
  10. AudriusButkevicius commented on Jun 12, 2019

    @AudriusButkevicius
    Member

    I am not arguing for sigkill, I am declaring how it works, and arguing that there might be other cases like that.

  11. calmh commented on Jun 12, 2019

    @calmh
    MemberAuthor

    Yeah, OK. I guess my point is that once you start sending SIGKILL it's all in the senders responsibility to clean up properly because agency is removed from the receiver. This goes for everything from separate processes to lock files and whatnot. In the Android case, if this is something that needs to happen, we can tweak the wrapper to accomodate.

  12. added 3 commits that reference this issue on Jan 19, 2020
    f2e49f9
    12b4bdd
    86ea10d
  13. added a commit that references this issue on Jan 21, 2020
    7ee903a
  14. added this to the v1.4.0 milestone on Jan 24, 2020
  15. added 2 commits that reference this issue on Jan 30, 2020
    35caa6a
    32ba321
  16. added
    frozen-due-to-age
    on Jan 20, 2021
  17. locked and limited conversation to collaborators on Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions