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

Two instances of syncthing in Activity monitor #39

Closed
enaloha opened this issue Aug 14, 2017 · 7 comments
Closed

Two instances of syncthing in Activity monitor #39

enaloha opened this issue Aug 14, 2017 · 7 comments

Comments

@enaloha
Copy link

enaloha commented Aug 14, 2017

After updating tp the latest version, I see two syncthing processes. The previous version showed only one executable running. Haven't noticed any problems with that, but thought I should mention.

image

@xor-gate
Copy link
Member

xor-gate commented Aug 14, 2017

I can verify this also on my system. They are sub processes of each other so no double syncthing instances are running (multithreaded application). See my activity log screenshot below with detailed process info.

  • pid 397 - Syncthing.app started with launchd (osx process launcher)
    • pid 398 (process group 398) - syncthing master process
      • pid 42535 (process group 398) - syncthing child process (threads)

screen shot 2017-08-14 at 07 40 06

cc @virusman do you agree with this?

@enaloha
Copy link
Author

enaloha commented Aug 19, 2017

I have observed this issue and I think it might be a bug (or at least a problem). I don't think this has anything to do with multi-threading. These are clearly two processes with individual PIDs (if each app would open a PID for each thread it would be crazy). Anyway, the problem is that whenever Syncthing demon hangs and I need to terminate via the "Quit Syncthing" menu item, the Syncthing app will hang because it cannot shut down both PIDs (only one is closed).

@xor-gate
Copy link
Member

Yes syncthing-macosx bundle starts syncthing daemon as its child process and are two separated processes. It weird you have to kill syncthing, I have not had any problem with it as long as I'm using my own syncthing-macosx. But you are right it should be "easier to kill". A simple solution doesn't come to my mind yet.

@virusman
Copy link
Contributor

Yeah, I see the same thing: syncthing forks a new process upon launch. I think this is by design. I launched syncthing from command line, and it also spawned two processes.
@enaloha Threads and processes are different things, both can be used for different reasons; and forking new processes is definitely common practice for daemons.

@xor-gate
Copy link
Member

This is the nature of golang applications, it always spawns minimal two processes. The runtime automatically scales over multiple threads.

@xor-gate
Copy link
Member

xor-gate commented Sep 12, 2017

To protect against two running syncthing daemons spawned from syncthing-macosx we probably could store a pidfile and try to kill it before starting a new instance (and removing the file). I'm not sure syncthing daemon will detach from the syncthing-macosx parent process when something goes wrong. But this needs some investigation and work.

@xor-gate xor-gate added invalid and removed question labels Jun 4, 2018
@xor-gate
Copy link
Member

xor-gate commented Jun 4, 2018

I'm closing this, as I think it as I have investigated earlier. Its just a sub-process of syncthing. It would also be nice to control the actual start/stop/restart of the subprocess (See #48). Feel free to comment or ask if something is unclear.

@xor-gate xor-gate closed this as completed Jun 4, 2018
@syncthing syncthing locked and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants