sproutcore / abbot

SproutCore Build Tools [deprecated]
http://www.sproutcore.com
88 stars 44 forks source link

sc-server does not stop with ctrl-c and eats up cpu #86

Open radbasa opened 12 years ago

radbasa commented 12 years ago

I followed https://gist.github.com/1860325 and ran sc-server:

$ ./bin/sc-server --allow-from-ips="*.*.*.*"
SproutCore v1.7.1.beta Development Server
Allowing access only from IPs: *.*.*.*. Use --allow-from-ips='*.*.*.*' to allow all
Starting server at http://0.0.0.0:4020 in debug mode
To quit sc-server, press Control-C
>> Thin web server (v1.2.11 codename Bat-Shit Crazy)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4020, CTRL+C to stop
^C
^C^C^C
^C^C^C

I can't ctrl-C out of sc-server. I have to kill -9 it.

Also, accessing server:4020/todos with a browser pushes ruby to hit the roof. I am guessing this is sc-server. The welcome to sproutcore page also hasn't loaded after several minutes have passed.

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
17934 xxxxx   20   0 63496  55m 4304 R 99.5 11.1   6:37.57 ruby 

I will try a delete of abbot and then a reinstall.

workmanw commented 12 years ago

@radbasa Would you mind running sc-server with verbose for me?

sc-server --allow-from-ips="*.*.*.*" --verbose

Edit: Please delete your tmp directory first, then re-run sc-server with verbose.

radbasa commented 12 years ago

@workmanw sorry, I've already redownloaded abbot.git.

Looks fine now. It's not using a lot of cpu now. But I still can't ctrl-c out.

sc-server with verbose: https://gist.github.com/1923934

radbasa commented 12 years ago

Uh oh, spoke too soon. I just reloaded the page now, and I'm not getting any response. Ruby has hit 95% cpu use again.

last verbose log from sc-server is: INFO 04:17:07.005 ~ Serving todos:source/main.js INFO 04:19:28.002 ~ Serving todos:index.html

It might be because I've already sent ctrl-Cs to sc-server.

Edit: Yes, I believe the high CPU usage by ruby happens after I send a ctrl-C to sc-server, which doesn't stop, and I refresh the browser.

radbasa commented 12 years ago

Filing a report of the irc session I had with unicolet regarding this issue.

Running on Ubuntu 11.04 (GNU/Linux 2.6.38-8-generic-pae i686), Linux n0 2.6.38-8-generic-pae #42-Ubuntu SMP Mon Apr 11 05:17:09 UTC 2011 i686 i686 i386 GNU/Linux ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] also tried ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]

with sc-server running, and ctrl-c is sent, strace gave us: gettimeofday({1329948762, 254615}, NULL) = 0 select(6, [3 5], [], [], {0, 90000}) = ? ERESTARTNOHAND (To be restarted) --- SIGINT (Interrupt) @ 0 (0) --- rt_sigreturn(0x6) = -1 EINTR (Interrupted system call) clock_gettime(CLOCK_MONOTONIC, {32892, 297346880}) = 0 gettimeofday({1329948762, 266327}, NULL) = 0 clock_gettime(CLOCK_REALTIME, {1329948762, 266350485}) = 0 futex(0x98c68e8, FUTEX_WAIT_PRIVATE, 1, {0, 4976515}) = -1 ETIMEDOUT (Connection timed out) futex(0x98c6930, FUTEX_WAKE_PRIVATE, 1) = 0

Installed sproutcore 1.8 on Ubuntu 10.04.2 LTS Linux l0 2.6.32-28-generic-pae #55-Ubuntu SMP Mon Jan 10 22:34:08 UTC 2011 i686 GNU/Linux ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]

sc-server stops as it should when sent a ctrl-c

unicolet commented 12 years ago

I was able to reproduce it and turns out it is not a ruby or sproutcore issue, but rather a Linux kernel regression issue. Easily fixed it by upgrading the kernel with:

  sudo  aptitude safe-upgrade

Reference: http://bugs.ruby-lang.org/issues/4777

radbasa commented 12 years ago

It looks like it is isolated to Linus kernel 2.6.38 of which Ubuntu 11.04 is based on.

I tried safe-upgrade you mentioned, it didn't work for me.

I have since upgraded to Ubuntu 11.10. Without touching or reinstalling the abbot 1.8, ctrl-C works now.