I'm running fable's watch feature via a FAKE script here. When I end the FAKE script, it does kill the node process associated with Fable but not Fable.Client.Node.exe. Fable.Client.Node.exe then process to peg 1 core at 100%.
This can be exhibited by just running fable --watch and killing the node process associated with it.
Simple repro:
fable --watchps -a | grep fable35590 ttys000 0:00.82 node /usr/local/bin/fable -wkill -9 35590More involved usage:
Please provide the steps required to reproduce the problem
Killing all processes that are created by FAKE and are still running.
Trying to kill node
Trying to kill process node (Id = 34955)
Trying to kill node
Trying to kill process node (Id = 34954)
Trying to kill mono
Trying to kill process mono (Id = 34958)
Killing child processes is hard, but the child process probably should not peg a core at 100%
Child process stays around and pegs a core at 100%
I could try to find the Fable.Client.Node.exe in the FAKE script and kill it. However not sure what to do in the simple case of just using fable --watch and killing the node process associated with it.
Interesting, so far I've been always using fable -w in a terminal and killing the node process also killed the node one. Explicitly killing the node process with kill -9 should be a rare case but it's true we have to handle workflows like yours with a FAKE script. I'm not sure why the mono process goes rogue and consumes so much CPU 馃槙
I don't know much about interprocess communication so I don't know if there's a more sophisticated way to solve this. The only solution I can think of at the moment is sending a KEEP_ALIVE message (say every second) and let the mono process finish if it doesn't receive it after 1 or 2 seconds. Do you think that would work?
That seems reasonable. Probably want to get the opinion of a few more people before you go down that path :)
I'm investigating this and actually setting a timeout for Console.ReadLine is not a trivial task 馃槙 It maybe easier to add a way to terminate gracefully the node process (say pressing enter) so it can send a termination signal to Fable.Client.Node.exe. The only thing with that is you need to remember this in your FAKE script. We could add a FAKE helper to make it easier. What do you think?
That could absolutely work. I could just implement IDisposable and send something to the node process to clean it up before I edit my FAKE script.
I guess I could add a reference to Mono.Posix and send the right unix signal, but that would be tightly coupled to. mono. I haven't tried to repro this on windows but i assume making it cross platform is he best answer.
@forki do you have any input? Have you seen anything similar to this before with other FAKE helpers?
Fake process killer might be buggy. Maybe try to build your own fake.exe and add lots of tracing. Maybe you can find the issue.
For now the easiest solution would probably be to terminate watching when enter is pressed and then add a disposable Fable helper to FAKE as @TheAngryByrd proposed. I'll take care of the first part :+1:
I've added the termination signal when pressing enter for the watch process in master. Could you give it a shoot at creating the FAKE helper and confirm if it works for you? Thanks!
Yep works for me now! Thanks a bunch!