-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Plugin is spawning multiple flow server processes in different projects #27
Comments
I've tried to add the following line to process.on('exit', () => childProcess.spawnSync(getFlowBin(), ['stop'])); This works nice with webpack in watching mode but is not good if you are using eslint in your editor because it kills flow server everytime lint process is done. |
What version are you using? Try both |
I am using I don't see any nice solution to this because we can't detect if you've stopped your work on project. So flow server will stay running. So how many separate projects you start, that many flow servers you will have running. For example: I am working on project A ( Only way to stop server from A is by running |
What if the servers could have some kind of timeout option where they will automatically be killed after a certain time, say 1 hour? Also how impactful is the instantiation of new flow servers on your machine? I haven't noticed much one mine (but this is still an issue that i'm going to fix) |
I haven't noticed any impact on my machine. I came across it when I was debugging my app. It is just eating memory even if it is not used. Timeouts would be good but how should they work? For example: I am using webpack in watch mode with Perhaps mentioning it in readme is enough so user will know that they need to stop flow server manually. |
I think that this module should be responsible for handling servers that it instantiates. I think the timeout method is a good one. |
@jdmota Would be great if you could look into this. I think it can be solved by small json object of when flow was last run on the project and killing the processes if flow hasn't been run on the project in an hour or so? {
'/Users/foo/project-1': '1490553978', // <- unix timestamp?
'/Users/foo/project-2': '1490554013'
} |
I will take a look. I just need to understand how the flow server works. Maybe trying to start a flow server ahead of time can help... eslint-plugin-flow-check does that actually. |
Probably I'm not understanding the issue correctly... because when I run flow, there are processes that stay on the background, but they close immediately when I close the terminal. So I don't know if there is really a problem that needs to be fixed here... |
They actually stay open. This is good because flow can cache. The downside is that we have to kill them after a certain time period |
In my case, they seem to close... Maybe because I'm on Windows?... Anyway, how do we kill the processes after a certain time period? Can you explain exactly your ideia? I'm a little confused 😄 |
You would probably do something like execSync('flow stop path/to/server') The issue gets pretty bad when you use eslint to check errors as you type. |
Yes. But, that json file you mentioned before; it will only help close processes from previous projects, and it would require someone to run eslint again so that we can check if flow hasn't been run in an hour, am I correct? (Was I clear? My english is not perfect 😜 ) |
Yes. We may be able to use some kind of process manager like pm2. I think that will be a much more elegant solution than the json file one |
On the flow documentation I saw that there is a Do you think it can be useful to us? Maybe flow is able to close itself if it knows what started it??? |
I haven't used it before so I'm not sure. I would recommend asking on the gitter chat or whatever chat the flow team uses now |
still have this issue, any update or fix? |
I have only one work around. In my case I'm using webstorm, so I need to turn off Flow type checking from webstorm, remove |
I believe i know the fix for this. But its will take some time, which i dont have a lot of right now. Hope someone can PR this. |
Maybe we could add a setting like process.on('exit', () => childProcess.spawnSync(getFlowBin(), ['stop'])); I think it would be good, at least as a work around. Besides, although keeping the flow server alive is good for caching, I think in most cases, when people run Thoughts? |
@jdmota I think we should test this out and see how it impacts performance. How about creating a new branch. I can publish a new prerelease in |
This is still an issue for me. Maybe there is some workaround? |
I reported the issue in the wrong repository... I'm ashamed, sorry! 🙏 |
I have the same issue? Any fix for this? |
I've had this issue occur when running multiple versions of I recommend checking if you have a global version installed or if your repo has multiple |
For anyone else running into this problem, in our case it was a problem with Flow running out of memory with its dependency hash table. Naturally, no error is logged about it, the server just crashes and is restarted over and over again which results in the above. Increasing the hash table size in [options]
server.max_workers=1
sharedmemory.hash_table_pow=22 |
When I run eslint configuration with this plugin in different projects there are multiple flow processes running as a result.
Only way to get rid of these processes is to stop them manually.
This is screenshot when I run linting in 2 projects.
Is there a mechanism to stop them automatically? I know that it is hard because you start server on first run and then use
flow check-contents
to keep this plugin performant.The text was updated successfully, but these errors were encountered: