Skip to content

rails new and rails server sometime hangs and crashes on busy F5(reloading) while starting #27455

Closed
@yoshiokatsuneo

Description

@yoshiokatsuneo

Steps to reproduce

  1. Creating a new rails project using "rails new" using rails 5.0.1
% rails new huga
% cd huga
  1. Start the server (puma) with default settings (5 Threading)
% rails server
  1. Send HTTP request twice at the same time, by running a command below:
$ wget -O /dev/null http://localhost:3000/ & wget -O /dev/null http://localhost:3000/

Or, on the browser(Safari, Chrome), just push F5(reloading) button many times(like 3 times / sec).
But, in this case, I can reproduce the issue once in 3-10 times.

  1. Normally, rails response to the request, but sometimes, rails hangs and never response for the connection after that. And, in rare case(once in 20-30 times?), after pushing "Ctrl-C", ruby crashes with a segmentation fault error.

The problem does not happens if I change the number of puma thread from 5 to 1. So, I guess it is related to multi threading.
I see the issue on both Mac OS Sierra, and Ubuntu16.04.
I see the issue on both sqlite3 and mysql database.

Expected behavior

Rails should not crash and response like:

$ rails server 
=> Booting Puma
=> Rails 5.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.2 (ruby 2.3.3-p222), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
Started GET "/" for ::1 at 2016-12-26 15:28:15 +0900
Processing by Rails::WelcomeController#index as HTML
  Parameters: {"internal"=>true}
  Rendering /Users/tsuneo/.rvm/gems/ruby-2.3.3@rails5/gems/railties-5.0.1/lib/rails/templates/rails/welcome/index.html.erb
  Rendered /Users/tsuneo/.rvm/gems/ruby-2.3.3@rails5/gems/railties-5.0.1/lib/rails/templates/rails/welcome/index.html.erb (4.7ms)
Completed 200 OK in 25ms (Views: 12.3ms | ActiveRecord: 0.0ms)

Actual behavior

Sometimes, (like once in 3-10 times) Rails hang up and never response, and output log like below:

$ rails server 
=> Booting Puma
=> Rails 5.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.2 (ruby 2.3.3-p222), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
Started GET "/" for ::1 at 2016-12-26 15:29:24 +0900
Started GET "/" for ::1 at 2016-12-26 15:29:24 +0900

In rare case, after pushing Ctrl-C, following crashing report follows.

^CExiting
/Users/tsuneo/.rvm/gems/ruby-2.3.3@rails5/gems/activesupport-5.0.1/lib/active_support/inflector/methods.rb:270: [BUG] Segmentation fault at 0x0070000d11d938
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:                    
     * ~/Library/Logs/CrashReporter                                         
     * /Library/Logs/CrashReporter                                          
     * ~/Library/Logs/DiagnosticReports                                     
     * /Library/Logs/DiagnosticReports                                      
   for more details.                                                        
Don't forget to include the above Crash Report log file in bug reports.     

-- Control frame information -----------------------------------------------
c:0056 p:---- s:0348 e:000347 CFUNC  :const_get
c:0055 p:0038 s:0344 e:000343 BLOCK  /Users/tsuneo/.rvm/gems/ruby-2.3.3@rails5/gems/activesupport-5.0.1/lib/active_support/inflector/methods.rb:270 [FINISH]
c:0054 p:---- s:0339 e:000338 IFUNC 
...

I attached the full crashing message, and diagnose report.

System configuration

Rails version:
5.0.1

Ruby version:
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]

ruby_2016-12-26-152934_MacBook-Pro-2.crash.txt
rails_server_crash_output.txt
rails_server_crash_output_linux.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions