puma: 401 Unauthorized - server hangs when do multiple requests in same time

Hello! Thanks for the amazing Puma!

When I send multiple (4) requests in same time from my app to api sometimes server hangs forever. And I need to do ctrl+c and then I see something like:

^CExiting
Completed 401 Unauthorized in 5348ms (ActiveRecord: 75.9ms)

All requests have authorization header (with Token) so they 100% authorized.

And I don’t have enough knowledge to know where to go from here.

My solution for now - restart server again and again. Sometimes server can respond normally for these requests and sometimes it hangs forever.

Could you give some advice?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 25 (6 by maintainers)

Most upvoted comments

There’s a 10% chance that this fixes anything, but can anyone experiencing this issue try adding:

queue_requests false

… to their puma.rb files or try the latest master and report back if that fixes anything?

If that doesn’t help, try and follow this guide from New Relic about debugging stuck Ruby processes and post any output/information you can pull out of your stuck processes.

I’m facing the same issue. This is my environment:

Puma starting in single mode…

  • Version 3.8.2 (ruby 2.3.3-p222), codename: Sassy Salamander
  • Min threads: 5, max threads: 5
  • Environment: development
  • Listening on tcp://localhost:3000

Started GET “/api/v1/reason_types” for ::1 at 2017-05-09 16:33:15 +0800 Started GET “/api/v1/reasons” for ::1 at 2017-05-09 16:33:15 +0800 Exiting Terminate batch job (Y/N)? y

when i do multiple ajax/fetch call the server hangs. But its working fine if just call 1 at a time.

Started GET “/api/v1/sites” for ::1 at 2017-05-09 16:33:00 +0800 Processing by Api::V1::SitesController#index as JSON Parameters: {“site”=>{}} User Load (0.0ms) SELECT users.*… Completed 200 OK

@kengreeff I’m experiencing the same issue with the exact same configuration except I’m on Puma 3.8.2 (I thought I had found the culprit earlier but I had not, see my previous comment).

@nateberkopec any thoughts on how we can go about debugging this highly frustrating issue?

Edit: Nevermind, it’s something else. A gem possibly. I just tried WEBrick and I have the same issue.