kubosuke

kubosuke

FLAME failed with timeout in fly.io

I’m trying to setup flame on fly.io, but it failed with timeout errors. could you give me some idea if you have any?

environment:

Erlang/OTP 26 [erts-14.2.5.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
IEx 1.18.3 (compiled with Erlang/OTP 26)

{:flame, "~> 0.5.2"}

logs of flame worker node:

2025-04-25T15:11:36Z [info] INFO Preparing to run: `/app/bin/server` as nobody
2025-04-25T15:11:36Z [info] INFO [fly api proxy] listening at /.fly/api
2025-04-25T15:11:36Z [info]Machine created and started in 8.029s
2025-04-25T15:11:36Z [info]2025/04/25 15:11:36 INFO SSH listening listen_address=[fdaa:2:be18:a7b:3b0:c08b:f1fa:2]:22
2025-04-25T15:11:39Z [info]15:11:39.972 [info] starting with parent %FLAME.Parent{pid: #PID<85562.6154.0>, ref: #Reference<85562.3010329052.226492417.95334>, backend: FLAME.FlyBackend, node_base: "myapp-staging-159f7049-flame-5bcd1a05094c255608f0", flame_vsn: "0.5.2", backend_vsn: "0.5.2", backend_app: :flame, host_env: "FLY_PRIVATE_IP"}
2025-04-25T15:11:39Z [info]15:11:39.976 [info] connect (1) :"myapp-staging-159f7049-01JSPQHV6C4EKNCC73E9V5ZV1B@fdaa:2:be18:a7b:3ad:ede4:6e46:2": true
2025-04-25T15:11:40Z [info]15:11:40.157 [info] Discovered node :"myapp-staging-159f7049-01JSPQHV6C4EKNCC73E9V5ZV1B@fdaa:2:be18:a7b:3ad:ede4:6e46:2" in region fra
2025-04-25T15:11:40Z [info] WARN Reaped child process with pid: 699 and signal: SIGUSR1, core dumped? false
2025-04-25T15:12:09Z [info]15:12:09.979 [info] FLAME.Terminator.system_stop: parent pid #PID<85562.6154.0> went away :timeout. Going down
2025-04-25T15:12:10Z [info]15:12:10.005 [info] Postgrex.Protocol (#PID<0.5278.0>) disconnected: ** (DBConnection.ConnectionError) client #PID<0.5282.0> exited
2025-04-25T15:12:10Z [info]15:12:10.020 [error] :gen_statem #PID<0.5278.0> terminating
2025-04-25T15:12:10Z [info]** (stop) exited in: GenServer.call(Postgrex.Parameters, {:insert, %{"DateStyle" => "ISO, MDY", "IntervalStyle" => "postgres", "TimeZone" => "UTC", "application_name" => "", "client_encoding" => "UTF8", "default_transaction_read_only" => "off", "in_hot_standby" => "off", "integer_datetimes" => "on", "is_superuser" => "on", "scram_iterations" => "4096", "server_encoding" => "UTF8", "server_version" => "16.6 (Ubuntu 16.6-1.pgdg24.04+1)", "session_authorization" => "postgres", "standard_conforming_strings" => "on"}}, 5000)

I’m generating test flame job with:

FLAME.call(MyApp.HTMLToPDFRunner, fn -> 123 end, timeout: :infinity)

at least it succeed in the LocalBackend (I mean, on my local).

application.ex

defmodule MyApp.Application do
  @moduledoc false

  use Application
  require Logger

  @impl true
  def start(_type, _args) do
    flame_instance? = not is_nil(FLAME.Parent.get())

    children =
      children_process_list(flame_instance?) ++
        Application.get_env(:myapp, :child_processes, [
          #...
        ])

    opts = [strategy: :one_for_one, name: MyApp.Supervisor]
    events = [[:oban, :job, :start], [:oban, :job, :stop], [:oban, :job, :exception]]

    :telemetry.attach_many("oban-logger", events, &MyApp.ObanReporter.handle_event/4, [])
    Supervisor.start_link(children, opts)
  end

  # Process List for Flame Runner
  def children_process_list(true) do
    [
      #
    ]
  end

  def children_process_list(false) do
    [
      #...
      {FLAME.Pool,
       name: MyApp.HTMLToPDFRunner,
       min: 0,
       max: 10,
       max_concurrency: 10,
       idle_shutdown_after: :timer.minutes(3),
       boot_timeout: :timer.minutes(3),
       shutdown_timeout: :timer.minutes(3),
       log: :debug}
    ]
  end
end

runtime.ex

  config :flame, :backend, FLAME.FlyBackend

  config :flame, FLAME.FlyBackend,
    token: System.fetch_env!("FLY_API_TOKEN"),
    boot_timeout: 60_000,
    env: %{"RELEASE_COOKIE" => "***"}

  config :flame, :terminator, log: :info

First Post!

kubosuke

kubosuke

somehow after I upgraded OTP from 26 to 27 it’s resolved. some incompatibility?

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

Other popular topics Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New

We're in Beta

About us Mission Statement