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

1

12

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
Parmentier answered 5/9, 2017 at 9:44 Comment(6)
Probably the /api/invoicing-sessions hangs or fails. Can you step through your code with a debugger?Zoogeography
The execution did not reach my codeParmentier
Hey, you ever found a specific reason for this? I have the same issue (occasionally)Epileptic
I solved with config.eager_load = true in config/environments/development.rbParmentier
But don't know why thoughParmentier
github.com/rails/rails/issues/32082Joellejoellen
M
4

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
Monopoly answered 30/10, 2019 at 18:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.