Rust - Main child exited normally with code: 0. Failed due to unhealthy allocations?

I have a simple bot that runs once an hour. Locally, it works fine. On fly.io, it seems to crash immediately? It’s written in Rust.

My fly.toml is:

# fly.toml file generated for reddit-bot-rust on 2022-04-10T01:20:32-04:00

app = "reddit-bot-rust"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]

[experimental]
  allowed_public_ports = []
  auto_rollback = true
  cmd = ["./rusty-bot"]

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

The logs are:

2022-04-10T06:08:25.000 [info] Starting virtual machine
2022-04-10T06:08:25.000 [info] Starting init (commit: 6f9865f)...
2022-04-10T06:08:25.000 [info] Preparing to run: `./rusty-bot` as app
2022-04-10T06:08:25.000 [info] 2022/04/10 06:08:25 listening on [fdaa:0:59ec:a7b:21a1:cf3d:b3e3:2]:22 (DNS: [fdaa::3]:53)
2022-04-10T06:08:26.000 [info] Main child exited normally with code: 0
2022-04-10T06:08:26.000 [info] Starting clean up.

and my Cargo.toml is:

[package]
name = "rusty-bot"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
roux = "1.3.11"
tokio = { version = "1.17.0", features = ["full"] }
mailjet-rs = "0.2.0"

Running the debug build locally works fine, so I’m not sure what the issue is.

Do you have a way to enable more logs for your app? it seems like it starts and immediately exits with a code of 0.

Do you have a Dockerfile? If so, can you show us, that might help troubleshooting.

Do you actually have something listening on 8080 when you start the container? Fly runs two checks for that port when deploying, and will give this error when the check fails.

You can see these checks here:

$ flyctl checks list