How to deal with timeout issue when debugging Phoenix app

There is a common scenario: You'd like to debug your Phoenix app with break!/4 or IEx.pry/0. Everything works fine, until... Phoenix server throws a timeout error statement.

** (EXIT from #PID<0.5227.0>) shell process exited with reason: shutdown

It happens after about 60 seconds. Why?

The process has a certain amount of time to send a response. If it takes more - then the server says: "It takes too long. The process is probably suspended and in the meanwhile, the Client/user is raging on the other side. Let's kill him... (the process, not the user)".

Usually, it's a very nice, and helpful logic. But in the case of debugging it might be a real pain in the neck.

As soon, as we know the reason, we're able to find the solution. And here we are. Just set the idle_timeout option at your endpoint config. Generally at config/dev.exs, or so.

config :appname, Appname.Endpoint,
  http: [
    protocol_options: [idle_timeout: 5_000_000_000],
    ...   
  ]
A girl receiving new message

Sign to our Newsletter

We're committed to your privacy. Curiosum uses the information you provide to us to contact you about our relevant content. You may unsubscribe from these communications at any time. For more information, check out our privacy policy.

Oskar Legner
Oskar Legner

Read more
on #curiosum blog

Phoenix LiveView Tutorial: Adding Phoenix PubSub and Pow Authentication to Messenger
  • Elixir

Phoenix LiveView Tutorial: Adding Phoenix PubSub and Pow Authentication to Messenger

We've already bootstrapped our Phoenix LiveView-based Messenger app's database structure and a first LiveView page.

This time, we're going to improve real-time communication between the app's users using Phoenix PubSub, and use the Pow library to add secure user authentication.

As of November 2020, the latest Phoenix LiveView version is 0.14.8 - and the series has been updated to match it!

5 top-tier companies that use Elixir
  • Elixir

5 top-tier companies that use Elixir

Elixir is a pretty capable language - and it consistently ranks near the top of most loved and wanted languages rankings. It has a large following and some very persuasive preachers as well. But that would not be enough to make me like it – what I need as real proof of its strengths is real businesses that strive with Elixir.

That’s what this list is all about – a bunch of stories from top companies that chose Elixir and never looked back. Let us show you how its power and versatility shows in practice.