Protocol.UndefinedError: protocol Jason.Encoder not implemented for #PID<0.32128.13> of type PID, Jason.Encoder protocol m...
sentry-io opened this issue · 1 comments
Sentry Issue: ELIXIR-OMG-68
Protocol.UndefinedError: protocol Jason.Encoder not implemented for #PID<0.32128.13> of type PID, Jason.Encoder protocol must always be explicitly implemented. This protocol is implemented for the following type(s): OMG.WatcherInfo.DB.Transaction, Ecto.Association.NotLoaded, Ecto.Schema.Metadata, Float, BitString, Decimal, Atom, Date, NaiveDateTime, Map, Time, Jason.Fragment, DateTime, List, Any, Integer
File "lib/jason.ex", line 199, in Jason.encode_to_iodata!/2
File "lib/phoenix/controller.ex", line 776, in Phoenix.Controller.__put_render__/5
File "lib/omg_child_chain_rpc/web/endpoint.ex", line 15, in OMG.ChildChainRPC.Web.Endpoint.instrument/4
File "lib/phoenix/controller.ex", line 792, in Phoenix.Controller.instrument_render_and_send/4
File "lib/omg_child_chain_rpc/web/controllers/alarm.ex", line 15, in OMG.ChildChainRPC.Web.Controller.Alarm.action/2
...
(3 additional frame(s) were not displayed)
(Protocol.UndefinedError) protocol Jason.Encoder not implemented for #PID<0.32128.13> of type PID, Jason.Encoder protocol must always be explicitly implemented. This protocol is implemented for the following type(s): OMG.WatcherInfo.DB.Transaction, Ecto.Association.NotLoaded, Ecto.Schema.Metadata, Float, BitString, Decimal, Atom, Date, NaiveDateTime, Map, Time, Jason.Fragment, DateTime, List, Any, Integer
previous discussion on: slack, release v1.0.2
unnawut
iex> OMG.Watcher.API.Alarm.get_alarms()
{:ok, [process_memory_high_watermark: #PID<0.28886.2>]}
unnawut
again not related to this release but we should fix in the next one
boolafish 2 days ago
So it cannot print the PID part?
boolafish 2 days ago
Cause we have to explicitly implement Jason?
unnawut
yeah, or inspect(pid) before printing
unnawut🌴 2 days ago
but I don’t think it’s useful to expose pid in /alarm.get though, so maybe we just need to remove the pid
unnawut
which is also weird it managed to deviate from these tests:
- https://github.com/omgnetwork/elixir-omg/blob/master/apps/omg_watcher/test/omg_watcher/api/alarm_test.exs#L38-L62
- https://github.com/omgnetwork/elixir-omg/blob/master/apps/omg_child_chain/test/omg_child_chain/api/alarm_test.exs#L51-L66
unnawut
oh waittttt
unnawut🌴 2 days ago
it’s raising process_memory_high_watermark not system_memory_high_watermark
unnawut
http://erlang.org/doc/man/memsup.html#description
Periodically performs a memory check:
- If more than a certain amount of available system memory is allocated, as reported by the underlying operating system, the alarm {system_memory_high_watermark, []} is set.
- If any Erlang process Pid in the system has allocated more than a certain amount of total system memory, the alarm {process_memory_high_watermark, Pid} is set.
unnawut
I think you just discovered a new edge case :yougotitdude:
:mindblown:
1