[Rails] What to do when rails s does not respond or does not stop

This phenomenon happens occasionally, so make a note as a reminder. I hope it helps those who have just started Rails and have fallen into the same situation.

Event

I'm working on an app while launching a local server and checking the operation with chrome ... When I thought it was unstable and waited steadily, I noticed that only the localhost: 3000 tab was stopped. When I try control + c in the terminal, it doesn't respond ... what is this ... I'm afraid to kill it, so what's the matter?

Figure reading `/ articles`` スクリーンショット 2020-10-07 15.41.42.png

approach

  1. Check ruby PID
  2. Stop ruby PID

1. Check ruby PID

Use the lsof command to check the processing running on port number 3000. ↓ Result of lsof -i: 3000 (Actually, there is output in the columns after USER)

daikimorita@daikinoMacBook-Pro javascript_skillcheck % lsof -i:3000
COMMAND     PID        USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
Google     xxxx 
 localhost:55103->localhost:hbci (ESTABLISHED)
ruby      xxxxx 
localhost:hbci (LISTEN)
ruby      xxxxx 
localhost:hbci (LISTEN)
ruby      xxxxx 
localhost:hbci->localhost:54631 (CLOSE_WAIT)
ruby      xxxxx 
localhost:hbci->localhost:54636 (CLOSE_WAIT)
ruby      xxxxx 
localhost:hbci->localhost:54655 (CLOSE_WAIT)
ruby      xxxxx 
localhost:hbci->localhost:54656 (CLOSE_WAIT)
ruby      xxxxx 
localhost:hbci->localhost:54659 (CLOSE_WAIT)
ruby      xxxxx 
localhost:hbci->localhost:55103 (ESTABLISHED)

The PID of ruby is displayed as xxxxx (enters a number). I want to stop this. The number of lines is because I pressed control + c many times lol

2. Stop ruby PID

Execute the following command.

kill -9 xxxxx

result

If you look at the "Tab of the terminal running rails s ", you will see killed and it is in standby mode.

zsh: killed

When I launched it again with rails s, the page was displayed in chrome safely. Solution!

Reference article

Rails server process is dropped quickly About PID About localhost: 3000 (Rails server process is dropped quickly ](https://qiita.com/kanuu/items/fd6e33fca6ad6a90d059#comments) )

Recommended Posts

[Rails] What to do when rails s does not respond or does not stop
[Rails 5] [Turbolinks] What to do when JS does not work due to page transition or browser back
What to do when rails db: seed does not reflect in the database
What to check when rails db: migration does not pass
What to do when Rails on Docker does not reflect controller changes in the browser
What to do when debugging "Source not found"
What to do when JSF tags do not become HTML
[Grails] Error occurred running What to do when the Grails CLI does not start
What to do when rails creates a 〇〇 2.rb file
What to do when is invalid because it does not start with a'-'
When the server does not start with rails s
What to do when Address already in use is displayed after executing rails s
What to do if the breakpoint is shaded and does not stop during debugging
What to do when Method not found in f: ajax
What to do when you launch an application with rails
What to do when javax.batch.operations.JobStartException occurs
Bluemix Infrastructure VPN does not connect because it does not support NPAPI! What to do when [Mac]
[Rails] What to do if data is not registered in DB
What to do when the changes in the Servlet are not reflected
java.security.InvalidKeyException: What to do when Illegal key size or default parameters
What to do when "relation" hibernate_sequence "does not exist" in the ID column of PostgreSQL + JPA
[Programming beginner] What to do when rails s becomes an error in the local development environment
What to do when a javax.el.PropertyNotWritableException occurs
JavaScript (vanilla) does not respond in Rails.
[Rails] [Memo] When to add = to <%%> and when not
What to do when undefined method ʻuser_signed_in?'
What to do if the app is not created with the latest Rails version installed when rails new
What to do when Blocked Host: "host name" appears in Ruby on Rails
What to do when "call'Hoge.connection' to establish a connection" appears on rails c
[Rails] Bootstrap form-control does not apply to date_select
What do you use when converting to String?
What to do when IllegalStateException occurs in PlayFramework
What to do if you get Could not locate Gemfile or .bundle / directory
What to do if ffi installation fails when launching an application in Rails
[Rails] What to do when the Refile image is not displayed when writing the processing at the time of Routing Error
[Rails] What to do if you get an error saying "Could not find a JavaScript runtime." When executing the rails s command on Catalina
After installing'devise''bootstrap' of gemfile with rails, what to do when url is an error
What to do if the Rails server can't start
What to do when The SSL certificate has expired
What to do if ClassNotFoundException occurs when starting Tomcat
What to do when rbenv says that there is no readline or lib history
What to do if rails server can't be stopped
What to do when ‘Could not find’ in any of the sources appears in the development environment with Docker × Rails × RSpec
What to do when a null byte error occurs
What to do when routing settings do not work after building Docker environment with Laravel
Library not loaded when trying to upgrade the version of ruby and rails s
Error ExecJS :: RuntimeUnavailable: What to do when it occurs
What to do if the JSONHint annotation does not work with lombok and JSONIC
What to do if you get an error saying "Could not find a JavaScript runtime." When starting rails server
ParseException: What to do when Unparseable date is reached
When rails g model does not respond when running * When running Rails Introduction # 5 of dot installation from AWS Cloud9
What to do if you installed Ruby with rbenv but the version does not change
[Ruby / Rails] What to do when NoMethodError appears when using a destructive method such as filter!
What to do when a could not find driver appears when connecting to a DB in a Docker environment
[Rails Tutorial Chapter 2] What to do when you make a mistake in the column name
[Rails] What to do when the view collapses when a message is displayed with the errors method
[Rails 6] What to do when a missing a template error occurs after introducing haml [Super easy]
[Ruby on Rails] When parameter id acquisition does not work
[Rails] The problem that pry-byebug does not stop through breakpoints
What to do if audio is not available on discordrb
What to do if FacesMessage is set but not displayed