Aptana Studio: A server is already running error - ruby-on-rails

Sometimes when I boot up my computer then open up Aptana Studio for Rails, then try to start my server, I get the following error...
=> Booting WEBrick
=> Rails 3.2.11 application starting in development on http://localhost:3000
=> Call with -d to detach
A server is already running. Check C:/Users/bob/bob_rails_demo/Course_Stats/tmp/pids/server.pid.
=> Ctrl-C to shutdown server
Exiting
When I check that file metioned, I open the file and all it says inside the file is ...
512
Is there a fix for this? I don't see anything else running in task manager. BTW I am running rails 3.2.11 w/ Windows 7.

I have the same problem too, and it didn't happen before, so i believe it is some kind of bug. What I do to solve it is simply delete the server.pid at C:[pathToApp]\tmp\server.pid file before starting my server.

It is saying that PID (process id) 512 is running the server.
Go to Start -> then type taskmgr.exe. Then, go to the processes tab and look for that process and kill it. It might be a bug that it does not close the server correctly on exit.

Related

A server is already running

I'm currently using cloud 9 for this project. When I run it using rails server -b $IP -p $PORt it gives me this:
=> Booting Puma
=> Rails 5.0.0 application starting in development on http://0.0.0.0:8080
=> Run `rails server -h` for more startup options
A server is already running. Check /home/ubuntu/workspace/saasapp/tmp/pids/server.pid.
Exiting
Does anyone know how to fix this? I already tried closing and re-opening the tabs again, and stop running the run project button. The language is ruby-on-rails and I'm sort of a beginner.
The error is happening because you most likely started your server, then closed the terminal before closing the server. I also had that error, but what I did was that I clicked the memory cpu disk icon on the top right corner, then clicked restart, and re-ran my server, and it started. I'm not sure if it's the proper way, but I was following a tutorial and that's what they showed.
This happens when you close the terminal tab before ending Rails.
To end Rails, find its process ID with lsof, then kill it:
lsof -i tcp:8080
[copy the PID]
kill -9 [paste PID]
bin/rails s
Alternatively, you can also find the process ID in Puma's temporary files using cat, then kill it:
kill -9 $(cat tmp/pids/server.pid)
bin/rails s
Open this file:
/home/ubuntu/workspace/saasapp/tmp/pids/server.pid as it states in the error.
The file should contain the process ID.
Copy the ID.
Open the terminal -> https://docs.c9.io/docs/terminal and run the command
sudo kill -9 {the copied ID}
Subsequently delete the ID from the server.pid file and try to start the server again

Everything worked, but then IntelliJ IDEA 14.02 has turned off, and then restart the project is not run and displays the following information

Everything worked, but then IntelliJ IDEA 14.02 has turned off, and then restart the project is not run and displays the following information :
"C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.0.2\bin\runnerw.exe" C:\tools\rubies\ruby-2.1.5-p273\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) E:/work/my_store/bin/rails server -b 127.0.0.1 -p 3000 -e development
=> Booting WEBrick
=> Rails 4.1.8 application starting in development on http://127.0.0.1:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
A server is already running. Check E:/work/my_store/tmp/pids/server.pid.
Exiting
Process finished with exit code 1
in the document E:/work/my_store/tmp/pids/server.pid. only four digits
4108
I use Windows 8, how to solve this problem ?
Use the Task Manager to check if a server process is running. If it is, stop it from the task manager. If not, delete the server.pid file.
I decided all by himself. server.pid deleted file later to restart the project file server.pid again been created, I deleted it again, restarted the computer and it worked

Why does my WEBrick server get killed?

I've got a rails development environment running in DigitalOcean on Ubuntu 12.04, but my WEBrick process keeps getting "killed" after a couple of hours. I haven't been able to find any settings or configuration that would cause this.
Example Console Ouput:
user#machinename:~/git/app$ rails s
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2014-01-05 09:14:29] INFO WEBrick 1.3.1
[2014-01-05 09:14:29] INFO ruby 2.0.0 (2013-11-22) [x86_64-linux]
[2014-01-05 09:14:29] INFO WEBrick::HTTPServer#start: pid=23452 port=3000
Started GET "/" for x.x.x.x at 2014-01-05 09:14:37 +0000
Processing by FunController#welcome as HTML
...
The server and app run just fine when I'm using it. But, at some point, my server will quit working. And, I'll look at the console to see this output from WEBrick:
Killed
And kick me back out to the shell. Any ideas what is causing this?
It runs out of memory. The linux kernel kills it. Droplets don't come with any 'swap' by default, so when the memory gets full, it kills a process or won't let you start a new one. Kinda crazy.
Here's an article walking you through adding a swapfile:
https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04
Note: I still had some problems with compiler processes being 'killed' even after adding a swapfile when 'swappiness' was set to 0. Upping it to 20 fixed the problem.
Note2: You really shouldn't use webrick in production as others have mentioned in the comments. Still, a question is a question :)

Ruby on Rails config change while server is running?

Hi I'm new to Ruby on Rails. I have installed the Testia Tarantula application and am trying to read up on Ruby.
My question is how do I start/stop the server.
For example: I want to change the Admin email, so I execute the following command to change the configuration of the app:
RAILS_ENV=production rake db:config:app
But is this command ok to execute while the server is running, it has 'db' in the command which is what would warn me that I shouldn't run it while the server is up. Anyone have some helpful tips for learning Ruby on Rails server app management?
Welcome to Rails!
You can run rake db:xxxxx while the server is running and it won't hurt anything. However I usually stop my server, run my rake command and then start it back up to ensure that all changes will be picked up. If running in production, I would think you may want to restart the server just to make sure. I believe that the schema is generated/updated upon server startup, just fyi.
As far as starting and stopping the server, if you are attached to it you can just use ctrl + c. If it is detached, you can search for the pid and then kill -9 .
Running rake db:anything will load rails on its own. It doesn't matter if you have a server up or not. This will happen in the background. Think of it as the same as running a sql script while the server is running. It's a separate process.

Not getting debug output for view errors in development mode

This is very odd. At the moment, I have some kind of error in a view, but can't see what it is. Also, no debug output in the web server trace.
The Rails 3.2.2 app is an upgrade from 2.7.10, and I'm using "thin" as my development server. I do get normal debug output when the error occurs in other places.
EDIT: I'm running development, as you can see here:
=> Booting Thin
=> Rails 3.2.2 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
EDIT: I can duplicate this behavior by raising an exception in the controller.
Please check you development.rb and ensure that
config.consider_all_requests_local = true
Otherwise exceptions and stack traces will not be shown.
I would compare the files in your ./config directory of your app with those of a clean Rails 3.2 install. They've restructured things pretty significantly and there are often strange errors like this that popup if you don't properly upgrade all the config files.

Resources