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

Omnisharp server takes 100% CPU #40

Closed
chtenb opened this issue May 15, 2013 · 11 comments
Closed

Omnisharp server takes 100% CPU #40

chtenb opened this issue May 15, 2013 · 11 comments

Comments

@chtenb
Copy link
Contributor

chtenb commented May 15, 2013

I don't know if Omnisharp can be blamed for this, but everytime I start the server, the cli process (which is mono runtime) takes up 100% CPU usage.
This is certainly an unwanted thing.
I'm on Linux.

@nosami
Copy link
Contributor

nosami commented May 15, 2013

Just tried on Windows.... server sits at 0% when not in use. I'm not at my linux box to try it out.

Do you think 56bcb87 could have caused this?

@chtenb
Copy link
Contributor Author

chtenb commented May 16, 2013

I cannot be due to 56bcb87, since the while only loops when a line is entered, which doesn't happen generally.

@nosami
Copy link
Contributor

nosami commented May 16, 2013

I didn't think it would be that to be honest... just clutching at straws. Do you know if the 100% cpu usage is a recent issue?

I'd be interested to know if anyone else has this problem.

@chtenb
Copy link
Contributor Author

chtenb commented May 16, 2013

I just noticed that the problem doesn't occur when starting the server outside vim. Let me dig into this a little more.

@chtenb
Copy link
Contributor Author

chtenb commented May 16, 2013

I don't know if its a recent issue, since I could only get it working very recently. Could it have something todo with the way vim-dispatch is called, or with vim-dispatch itself?

@nosami
Copy link
Contributor

nosami commented May 16, 2013

I wouldn't imagine it was vim-dispatch related although I can't explain how starting the server outside vim would change anything. Sorry.

@chtenb
Copy link
Contributor Author

chtenb commented May 16, 2013

I found its not vim-dispatch related, since running the server manually by :!Omnisharp.exe -s mysolution.sln & results in 100% CPU usage as well.

@nosami
Copy link
Contributor

nosami commented May 16, 2013

I parse the solution in a background thread now since ed19c02. Maybe that is causing the problem.

@chtenb
Copy link
Contributor Author

chtenb commented May 16, 2013

As far as I can understand things now, it actually IS related to the while loop in 56bcb87 .
What happens (I guess) is that starting the server from within vim causes Console.ReadLine() to pass immediately, making the while statement loop very fast.

Thinking about a solution for this, I think we actually don't want to test stdin for input since that happens to lead to unwanted behaviour on different systems. I think we just want to have NancyHost running forever, until it is given a shutdown signal from port 2000 (or whatever the configured port is). Just like is done with windows forms when the Appliction.Run() method is invoked.

Could something similar be done for nancyhost? That would solve all these problems.

@nosami
Copy link
Contributor

nosami commented May 16, 2013

Not sure about the long term fix yet, but for now a simple Thread.Sleep(500) inside the while loop will sort your problem out.

@nosami
Copy link
Contributor

nosami commented May 16, 2013

Just pushed quick fix.

@nosami nosami closed this as completed May 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants