facebookarchive / ide-flowtype

Flow support for Atom IDE
Other
178 stars 17 forks source link

macOS - Spawning or not disposing of unnecessary processes? #21

Open bradennapier opened 7 years ago

bradennapier commented 7 years ago

Ok... so on the latest update that was done today... all seemed like it was going well.. then I opened my shell and try to run something and it says I hit the resource limits... knowing that is around 260 processes I check and sure enough:

image

Upon opening I immediately see a ton open. Im not sure if a flow process is opened for every tab I have open at which point there shoudl be 8 processes

image

The screenshot with all the flows happened at a time that i had atom in the background and wasnt using it for at least a hour or so.

wbinnssmith commented 7 years ago

Hi @bradennapier, I can't reproduce this. Can you confirm the behavior below, and if not, provide how you reproduced this differently?

The number of flow processes doesn't scale with the number of buffers you have open. Instead, flow forks around 5-10 processes for every instance in order to maximize parallelism and quickly respond to requests from the IDE.

I have about 7 or 8 flow processes running for every Flow project (with a .flowconfig) open, and when closing down the corresponding Atom window the number of processes drops by that many.

After opening several projects, I observed the number of processes scale linearly upward, and as I closed each I observed it drop linearly, eventually leading to zero flow processes for zero Atom windows.

Re: having Atom open for hours, we could explore serializing things like outline state and diagnostics and shutting down Flow during long periods of inactivity, and respawning the LSP server when movement happens again. cc @nmote, @damieng (perhaps there could be hooks for this in atom-languageclient).

bradennapier commented 7 years ago

@wbinnssmith I think that sounds like a good idea. This is definitely another issue though. I believe it has to do with the other post that othrs are also running into where flow does not appear to work correctly. I believe all this stems to the way it is handling flows runtimes

image

I had issues when I used the node_modules option. Doing it this way was the only way I got it to work.

bradennapier commented 7 years ago

So far it is stable again. Something must happen when it crashes that causes it to fail to respawn properly. Actually running into a simliar issue right now with a linux process that works similarly

image

bradennapier commented 7 years ago

I believe this issue may have been caused by the following issue. There were thousands of these errors and the times seem to match up

2017-09-13 23:52:22.132 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.133 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.133 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.133 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.133 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.134 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.134 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.136 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.137 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.139 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.139 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.139 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.141 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.142 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.143 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.143 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.143 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.144 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.144 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.145 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.145 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.146 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.146 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:52:22.147 ERROR (pid:24016) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:58:55.057 ERROR (pid:53648) nuclide-flow-rpc - Unknown return code from Flow: 110
2017-09-13 23:58:55.059 ERROR (pid:53648) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-13 23:58:59.461 ERROR (pid:54783) flow-versions - There was a problem obtaining the appropriate version of flow for your project. Please check the extension logs.
2017-09-13 23:58:59.465 ERROR (pid:54783) flow-language-server - unhandledRejection { Error: Unhandled method window/showMessageRequest
    at new ResponseError (/Users/bradennapier/.atom/packages/ide-flowtype/node_modules/vscode-jsonrpc/lib/messages.js:46:28)
    at handleResponse (/Users/bradennapier/.atom/packages/ide-flowtype/node_modules/vscode-jsonrpc/lib/main.js:421:48)
    at processMessageQueue (/Users/bradennapier/.atom/packages/ide-flowtype/node_modules/vscode-jsonrpc/lib/main.js:249:17)
    at Immediate.<anonymous> (/Users/bradennapier/.atom/packages/ide-flowtype/node_modules/vscode-jsonrpc/lib/main.js:233:13)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5) code: -32601 }
2017-09-14 18:47:19.250 ERROR (pid:72320) nuclide-flow-rpc - Unknown return code from Flow: 110
2017-09-14 18:47:19.252 ERROR (pid:72320) nuclide-flow-rpc - Attempted to update server status after disposal
2017-09-14 19:38:27.973 WARN (pid:55058) nuclide-flow-rpc - Invalid JSON result from flow get-def --json --path /Users/bradennapier/Desktop/Dash OS/IDE/projects/dash-desktop/app/shared/components/DebugConsole/components/DCMenu/DCMenu.js 1 11. JSON:
''.
2017-09-14 19:38:28.469 WARN (pid:55058) nuclide-flow-rpc - Invalid JSON result from flow type-at-p