Bandit - 1.5.7 Request idle timeout

Hello everyone,

I am trying to solve connection closed errors on Oracle Load Balancer.
In load balancer I have set 60 seconds ideal timeout, But for Bandit can’t find where to adjust request idle timeout. I want to set it at least 70-75 Seconds.
Currently I have endpoint settings like this:-

## config.exs
 #Configures the endpoint
  config :my_app, MyAppWeb.Endpoint,
    url: [host: "localhost"],
    adapter: Bandit.PhoenixAdapter,
    render_errors: [
      formats: [json: MyAppWeb.ErrorJSON],
      layout: false
    ]
## runtime.exs
if config_env() == :prod do
  config :my_app, MyAppWeb.Endpoint,
    url: [host: host, port: 443, scheme: "https"],
    http: [
      ip: {0, 0, 0, 0, 0, 0, 0, 0},
      port: port,
      thousand_island_options: [
        transport_options: [
          keepalive: true
        ],
        read_timeout: 80_000,
      ],
    ],
    debug_errors: false,
    check_origin: {MyApp.OriginCheck, :check_origin?, []},
    secret_key_base: secret_key_base
end

OS: Ubuntu 22.04
Elixir: 1.17.1
Erlang: Erlang/OTP 27 [erts-15.0]
Bandit: 1.5.7
thousand_island: 1.3.5
phoenix: 1.7.14

Thanks in advance.

As far as I know Bandit doesn’t have an idle timeout for request handling code. It will not stop you from sleeping forever and never sending a response. Any such timeouts will have to be enforced on your code by your own code.

Hello @joram,
Thank you for responding.
So does it mean that Bandit doesn’t close TCP connection at all?

Bandit won’t close the connection while your request handling code is running. Outside of that I think it just depends on the Thousand Island settings (your keepalive and read_timeout settings).

Okay,
I thought read_timeout is for how long to wait for body read.
I will tag Thousand Island also. May be will know exactly.

It is. I think I misremembered, read_timeout doesn’t seem relevant.