[erlang-questions] gen_server: {bad_return_value, {error, {91, invalid_string}}}

Ali Sabil <>
Tue Aug 15 11:09:05 CEST 2017


Hi Khitai,

That's because jiffy (mis)uses erlang:throw.

Best,
Ali

On Tue, Aug 15, 2017 at 5:13 AM, Khitai Pang <>
wrote:

> Hi Raimo, Attila,
>
> I have found out the cause: the handle_info callback of my gen_server
> failed to decode a json string:
>
> {Json} = jiffy:decode(Msg),
>
> the above code generates {error, {91, invalid_string}}, and I believe
> the error is caught by OTP gen_server code, and somehow the terminate()
> function in OTP gen_server code complains about {bad_return_value,
> {error, {91, invalid_string}}}.  Now I know the root cause of the
> problem but I don't understand why it ends up in an error of
> gen_server:terminate().
>
>
> Best wishes,
> Khitai
>
> On 2017/8/14 19:54, Attila Rajmund Nohl wrote:
> > Hello!
> >
> > I'd check the code that handles the
> > {basic.cancel_ok,<<"amq.ctag-YRIyK1Kv0i93rkLbD9Zo8w">>} message,
> > because this was the last received message. Also my intuition is that
> > somewhere your code expects a list of strings, but gets a simple
> > string, and when it checks the first element, it finds 91 (probably
> > the '[' character) instead of a string.
> >
> > 2017-08-14 5:17 GMT+02:00 Khitai Pang <>:
> >> Hi list,
> >>
> >> On my CentOS7 server with esl-erlang-19.3.6-1.x86_64, a gen_server
> >> process mysteriously crashes.  See the error info below.  I can't figure
> >> out the reason of the error.  Any hint would be appreciated.
> >>
> >> {error_report,<0.25443.97>,
> >>       {<0.28918.97>,crash_report,
> >>        [[{initial_call,{xeef_analyzer,init,[Argument__1]}},
> >>          {pid,<0.28918.97>},
> >>          {registered_name,xeef_analyzer_009},
> >>          {error_info,
> >>              {exit,
> >>                  {bad_return_value,{error,{91,invalid_string}}},
> >> [{gen_server,terminate,7,[{file,"gen_server.erl"},{line,812}]},
> >>                   {proc_lib,init_p_do_apply,3,
> >>                       [{file,"proc_lib.erl"},{line,247}]}]}},
> >>          {ancestors,[xeef_analyzer_sup,xeef_sup,<0.25310.97>]},
> >> {messages,[{basic.cancel_ok,<<"amq.ctag-YRIyK1Kv0i93rkLbD9Zo8w">>}]},
> >>          {links,
> >> [#Port<0.2317500>,#Port<0.2317503>,<0.29009.97>,#Port<0.2317499>]},
> >>          {dictionary,
> >>              [{rand_seed,
> >>                   {#{max => 18446744073709551615,next =>
> >> #Fun<rand.4.41921595>,
> >>                      type => exs1024,uniform => #Fun<rand.5.41921595>,
> >>                      uniform_n => #Fun<rand.6.41921595>},
> >>                    {[5529181756040335035,6774320120208346895,
> >>                      4985297473998268992,12813505499546735856,
> >>                      3059599059795068553,3134963973831305956,
> >>                      5508046504858988103,3821329447243874404],
> >>                     [6547380368325771448,16036002885223559991,
> >>                      13982350927889545678,14401258729428095242,
> >>                      6347438184782916914,10561027033563628251,
> >>                      10847483533189471003,3486622809589930158]}}}]},
> >>          {trap_exit,true},
> >>          {status,running},
> >>          {heap_size,987},
> >>          {stack_size,27},
> >>          {reductions,139726}],
> >>         []]}}
> >>
> >>
> >> {error_report,<0.25443.97>,
> >>       {<0.29009.97>,supervisor_report,
> >>        [{supervisor,{local,xeef_analyzer_sup}},
> >>         {errorContext,child_terminated},
> >>         {reason,{bad_return_value,{error,{91,invalid_string}}}},
> >>         {offender,
> >>             [{pid,<0.28918.97>},
> >>              {id,xeef_analyzer},
> >>              {mfargs,
> >>                  {xeef_analyzer,start_link,
> >> [{sandbox,{<0.28962.97>,<<"sanbox_queue">>},none,true}]}},
> >>              {restart_type,permanent},
> >>              {shutdown,5000},
> >>              {child_type,worker}]}]}}
> >>
> >>
> >>
> >> Best wishes,
> >> Khitai
> >> _______________________________________________
> >> erlang-questions mailing list
> >> 
> >> http://erlang.org/mailman/listinfo/erlang-questions
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170815/401e21fc/attachment.html>


More information about the erlang-questions mailing list