Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails server hangs (sometimes) after two requests by the frontend

I'm building a single page application. My frontend (written in React), makes two calls to the backend and the rails server hangs. I mean, the execution doesn't reach the actions involved and nothing happens. Suggestions? I spent so much time on this and I don't know what to think anymore. This is the console's output.

I tried with webrick as well so I don't think the issue is from Puma.

=> Booting Puma
=> Rails 5.1.3 application starting in development on http://localhost:3002
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.10.0 (ruby 2.4.1-p111), codename: Russell's Teapot
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3002
Use Ctrl-C to stop
Started GET "/api/working-groups" for ::1 at 2017-09-05 11:29:52 +0200
Started GET "/api/invoicing-sessions" for ::1 at 2017-09-05 11:29:52 +0200
like image 275
Ursus Avatar asked Sep 05 '17 09:09

Ursus


1 Answers

For anyone finding this question: this seems to still be an open Rails issue #33209.

The tl;dr workaround is to set:

# config/environments/development.rb
config.eager_load = true
like image 191
calebkm Avatar answered Nov 15 '22 13:11

calebkm