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

High CPU load on Darwin (Crystal 0.7.2) #706

Closed
Nightforge opened this issue May 29, 2015 · 7 comments
Closed

High CPU load on Darwin (Crystal 0.7.2) #706

Nightforge opened this issue May 29, 2015 · 7 comments

Comments

@Nightforge
Copy link

Hello!

Issue with crystal compiler 0.7.2 on OS X - high CPU load
Test code is:

puts "Hello from Crystal language!"
sleep 60

I test the same code on os x with 0.7.1 - has no issues. Crystal compiler for linux (0.7.1 and 0.7.2) also has no this issue.
screen shot 2015-05-29 at 18 18 12

@tommasop
Copy link

Same issue here with the simple http server code.

100% cpu loading


IN OBSCURO MIRANDA RELUCENT

On May 29, 2015, at 3:29 PM, Nightforge [email protected] wrote:

Hello!

Issue with crystal compiler 0.7.2 on OS X - high CPU load
Test code is:

puts "Hello from Crystal language!"sleep 60

I test the same code on os x with 0.7.1 - has no issues. Crystal compiler for linux (0.7.1 and 0.7.2) also has no this issue.


Reply to this email directly orview it on GitHub
.

@asterite
Copy link
Member

Seems it has something to do with the change to STDOUT (and others) from CFileIO to FileDescriptorIO and non-blocking IO for that. Not sure yet why it's happening.

@waj
Copy link
Member

waj commented May 29, 2015

The problem is that libevent is raising the "write" event for the STDOUT all the time, even though the event is registered with the ET (edge triggered) flag: https://github.com/manastech/crystal/blob/master/src/concurrent/scheduler.cr#L24

I'll investigate this further to find a solution. Thanks for reporting!

@asterite
Copy link
Member

In IRC @jhass confirmed this doesn't happen in linux, so maybe it's a bug in libevent for mac, but we'll have to investigate.

@waj waj closed this as completed in a0820c7 May 29, 2015
@waj
Copy link
Member

waj commented May 29, 2015

The solution could be more elegant... but it works for now. @Nightforge, @tommasop could you confirm if this fixes the issue?

@Nightforge
Copy link
Author

Confirmed!

1 similar comment
@tommasop
Copy link

tommasop commented Jun 2, 2015

Confirmed!

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

4 participants