erlang / otp

Erlang/OTP
http://erlang.org
Apache License 2.0
11.36k stars 2.95k forks source link

This error is intermittent and I am unable to trace where or why it comes up #7907

Closed CharlesOkwuagwu closed 11 months ago

CharlesOkwuagwu commented 11 months ago

Describe the bug This error is intermittent and I am unable to trace where or why it comes up.

I am unable to handle it with a try ... catch

13:24:39.161 [error] GenServer terminating
** (stop) bad return value: {:error, 'Malformed: Illegal character in literal value'}
Last message: {:"$gen_cast", {:process_request, %Message{agentid: nil, ref: "ABGHI0gDgzUgDwIQ42AO-_t4qucXquhyQEbgIQ", messageid: nil, userid: nil, typeid: 1, channelid: 1, channel: :WA, text: "3", media_path: nil, dt: nil, src: "234803#######", emoji: nil, via_360: true}, %User{agentid: nil, bot_date: nil, bot_cache: nil, cache: nil, channelid: 1, customerid: nil, data: nil, dob: nil, dt: nil, email: nil, fb_id: nil, fundid: nil, greeting: nil, ig_id: nil, mobile: "234803#######", name: "emmanuel#####@gmail.com", photo: nil, pin: nil, profile: nil, seen: nil, sex: nil, start_date: nil, step: nil, tg_id: nil, title: nil, emp_code: nil, emp_name: nil, tos_date: nil, tos_status: nil, tw_id: nil, userid: nil, page_id: nil, is_customer: false, unknown_skip: false, bot_user: false, menu: 0, tick: 0, otp: %{}, info: %{}}}}

13:24:39.161 [error] Process GW (#PID<0.488.0>) terminating
** (exit) bad return value: {:error, 'Malformed: Illegal character in literal value'}
    (stdlib 4.3) gen_server.erl:1245: :gen_server.handle_common_reply/8
    (stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Initial Call: GW.init/1
Ancestors: [WEBHTTP, GW.Supervisor, #PID<0.464.0>]

Affected versions

λ elixir --version
Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:20:20] [ds:20:20:10] [async-threads:1] [jit:ns]

Elixir 1.15.7 (compiled with Erlang/OTP 26)
garazdawi commented 11 months ago

Hello!

This does not seem to be a bug in Erlang/OTP, but rather in your code when using gen_server. The bad_return error happens when you return an invalid value from a callback function.

How to use a gen_server is described here.

If you need more help I suggest your try posting your issue and code to https://erlangforums.com