A memorable morning today, as I got my first serious Phoenix error in production. To be honest, the error is quite horrible, because it is a crash in my “Game Master” GenServer, which monitors all game sessions.
The problem is, the error I got from the logs wasn’t as useful as I’d hoped. The stack trace specifically doesn’t make sense to me, which is the first time I can’t pinpoint a problem in my Elixir code from the logs. I understand it’s a Poison encode error, which is super clear, but … where? How did we get here? Why did the game_master terminate?
(my best guess would be a truncated stack trace, but I don’t recall ever running into that… if so, how do I increase the limit?)
Any insights are greatly appreciated:
22:58:31.492 [error] Game result error: Repo update failure: [paid_coins: {"must be greater than or equal to %{number}",
[validation: :number, number: 0]},
paid_coins: {"must be greater than or equal to %{number}",
[validation: :number, number: 0]}]
22:58:31.496 [error] GenServer :game_master terminating
** (Poison.EncodeError) unable to encode value: {:ended, :white_player, :normal}
(poison) lib/poison/encoder.ex:354: Poison.Encoder.Any.encode/2
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3
Last message: {:DOWN, #Reference<0.0.130809857.143582>, :process, #PID<0.22428.17>, {:shutdown, %{...}}}
State: %{...}}