My fly apps suddenly returning 502 after restart

They are normally okay so i’m quite confused what’s happening

2024-03-13T13:06:41.079 app[e2865d45c90028] sin [info] Response status code for https://15m-vm.fly.dev/cache/binance/15m: 502

2024-03-13T13:06:41.079 app[e2865d45c90028] sin [info] Response status code for https://15m-vm.fly.dev/cache/bybit/15m: 502

2024-03-13T13:06:41.135 app[e2865d45c90028] sin [info] Response status code for https://1h-vm.fly.dev/cache/bybit/1h: 502

2024-03-13T13:06:41.135 app[e2865d45c90028] sin [info] Response status code for https://1h-vm.fly.dev/cache/binance/1h: 502

2024-03-13T13:06:41.252 app[e2865d45c90028] sin [info] Response status code for https://4h-vm.fly.dev/cache/binance/4h: 502

2024-03-13T13:06:41.252 app[e2865d45c90028] sin [info] Response status code for https://4h-vm.fly.dev/cache/bybit/4h: 502

2024-03-13T13:06:42.025 app[e2865d45c90028] sin [info] Response status code for https://5m-vm.fly.dev/cache/binance/5m: 502

2024-03-13T13:06:42.025 app[e2865d45c90028] sin [info] Response status code for https://5m-vm.fly.dev/cache/bybit/5m: 502

2024-03-13T13:06:42.429 app[e2865d45c90028] sin [info] Response status code for https://1d-vm.fly.dev/cache/binance/1d: 502

2024-03-13T13:06:42.429 app[e2865d45c90028] sin [info] Response status code for https://1d-vm.fly.dev/cache/bybit/1d: 502

Additionally, hitting the endpoints using postman return properly. How come when another fly machine hits the endpoints, it returns 502? I’ve also encountered this in the past and forgot how it got resolved. Would appreciate all the help as this is all production right now.

Hi, I suggest running fly logs in another terminal so you can see what’s happening.

Spoiler: Your app is segfaulting, crashing after beginning to process a response. When it dies, the connection to the Fly proxy gets closed; the error your clients see (502) indicates the backend server died mid-request; the proxy can do nothing but send the error and end things.

A common cause for segfaults with code that works locally, for example, might be low memory: your machines have only 256MB RAM. I would suggest as a first attempt to increase the memory and seeing if that helps. If not, it might indeed be that there’s a problem with your binary that you’d have to diagnose and fix.

Cheers!

  • Daniel
1 Like

Thanks, already resolved it!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.