Development server hangs on code changes

Hello all,

My colleagues and I are having issues with our development server hanging on code changes. There aren’t any traceback or errors on why this is happening, but I suspect it is ActionDispatch::Reloader causing the issue.

In config/environments/development.rb, I add this to see if ActionDispatch::Reloader could be causing the issue:

class WhatTheHeckMiddleware def initialize(app, opts = {}) @app = app @idx = opts[:idx] end

 # Just log when this middleware starts and ends
 def call(env)
   puts "~~ wth START #{@idx} ~~"
   res = @app.call(env)
   puts "~~ wth END #{@idx} ~~"
   res
 end

end

config.middleware.insert_before(ActionDispatch::Reloader, WhatTheHeckMiddleware, { idx: 1 }) config.middleware.insert_after(ActionDispatch::Reloader, WhatTheHeckMiddleware, { idx: 2 })

``

I reproduce the issue by making a code change and then server hangs:

2018-03-22T18:55:57 [I|app|] Started GET “/notification_recipients” for 127.0.0.1 at 2018-03-22 18:55:57 +0000 ~~ wth START 1 ~~ (server hangs here, no END statement is printed)

``

There is a similar issue found in graphql-ruby that did result in a commit to rails. (Their issue is where I got the debugging idea above) I tried the patch to rails without luck, It looks like we don’t even use the ActiveSupport::Reloader middleware mentioned in the issue.

We are using Rails 5.1.4

My questions are:

  • Does anyone have any ideas on what could be going on?

  • Am I correct in thinking something is going wrong in ActionDispatch::Reloader?

  • How can I debug this further?

Let me know if I can provide any more information.

Thanks!

Is the code you're changing related to the request method above? Does it work as expected when you make the change and restart the server?

Can you create and publish a simplified reproducible test case if this isn't open source?

If not, I'd say you just need to start adding debug logger statements (or pry breakpoints) to see where it stops...