I was running Linux Mint 13 prior to now, and just switched to Fedora 17. Since I have made the switch, I can no longer stop Webrick. I use Jetbrains Rubymine, and starting the server works fine, but as soon as I hit stop, or restart, it somehow detatches from the processes and I cannot use that port again until I reboot my computer. My first thoughts were that it was a problem with Rubymine, but when I start the server in a console, it does the exact same thing. I hit ctrl-c to stop it (and it appears to do so), but as soon as I go to start the server again on that port, it fails because of duplicate address in use.
Asked
Active
Viewed 4,299 times
2
-
What version of JRuby are you running? – Satish Aug 27 '12 at 16:01
-
also check out http://stackoverflow.com/questions/5891567/cant-stop-webrick-1-3-1-with-ctrl-c-on-ubuntu-11-04 – Satish Aug 27 '12 at 16:04
-
Sorry, I am new to stack overflow and was assuming I would receive an email when I got a response. I haven't seen one yet, but I thought I would double check. @Satish - I am using Ruby 1.9.2 with a few different patch numbers on each app. ALL of my apps regardless of the ruby version are experiencing the same issue. It does NOT appear to be specific to the application like the link you provided talked about. (thanks for that by the way) – Sean Aug 28 '12 at 23:08
1 Answers
1
I have this error on Mint (opposite to you, as I see) - Ubuntu machine always exits fine by CTRL+C. Solution without restarting your machine: kill Webrick process. Search for a PID of detached server process via ps aux | grep rails
command and then kill it via kill -9 <PID>
In one line you can run this in your project dir:
kill -9 `cat tmp/pids/server.pid`
(You can also set this command as an alias in your .bash_profile, to use more easily)
Or is there no Webrick process to kill, whatsoever?

Jakub Naliwajek
- 707
- 5
- 9
-
Weird.. I had mint 13 running and decided to switch to fedora because of a few bugs I could no longer stand, but i'm afraid this is worse. Regarding your temporary fix, I tried it before with no success, but using your method seems to work. I can see all of the running processes now, and was able to kill them. quick question though, how do you mean to use as an alias? don't I have to find the pid first before i can run the command? thanks for your help. I'm hoping someone knows the root of the problem because this is driving me nuts – Sean Aug 28 '12 at 23:17
-
If Webrick is running, then its PID is in `{APP_ROOT}/tmp/pids/server.pid` file so you don't have to look for it -- as long as server is running. So, if instead of doing `ctrl-c` you just run that kill command in another terminal, it will kill Webrick server immediately. You can create an alias, so instead of long `kill -9 ...` command you'll have to only type `killrails` or something, [just as any other alias in bash](http://ss64.com/bash/alias.html), see _"Make an alias permanent"_ section. – Jakub Naliwajek Aug 29 '12 at 10:30
-
Sorry for being so dense on this, but its not working for me. I do understand how to use alias in bash profile, but the part i'm not understanding is the generic command to kill the process in question. Here is what the alias I have: alias killapp="kill -9 ./tmp/pids/server.pid" I run this in the app root. It tells me: kill: ./tmp/pids/server.pid: arguments must be process or job IDs. What am I doing wrong? Thanks again for your help. – Sean Aug 30 '12 at 17:37
-
-
Thanks so much! that will help a lot. Although it isn't the ultimate fix for the issue, I will go ahead and mark your answer for now since nobody else seems to have any ideas. Thanks again. – Sean Aug 31 '12 at 15:47