[erlang-questions] missing line numbers when gen_statem crashes

Raimo Niskanen raimo+erlang-questions@REDACTED
Wed Jun 13 15:08:54 CEST 2018


On Wed, Jun 13, 2018 at 11:51:31AM +0200, Torben Hoffmann wrote:
> Hi,
> 
> I have a crashing gen_statem, but to the best of my knowledge I cannot see
> from the stock error messages which line my gen_statem dies on.
> 
> I have searched high and low in my console output, but this is the only
> thing that I could find:
> 
> =CRASH REPORT==== 13-Jun-2018::11:17:28 ===
>   crasher:
>     initial call: eee_sched_shard:init/1
>     pid: <0.3149.0>
>     registered_name: []
>     exception error: {badrecord,trans_opts}
>       in function  gen_statem:loop_event_actions_list/10 (gen_statem.erl,
> line 1210)

This is an internal crash in gen_statem - I think i recognize this
badrecord at line 1210.  Your callback module returns a bad action in the
actions list, and when gen_statem terminates there is a bug that causes it
to crash instead, hiding the informative reason.

It might be so that you return an action that is not allowed from a state
enter call, or simply a not recognized action.

Since the error is "cosmetic" or rather "not in the function", I did not
patch this in the 20.3 track.  The bad diagnostics error was introduced in
20.3 and is corrected in 21.0-rc1 and forwards.


>     ancestors: [<0.3148.0>,<0.3114.0>,<0.3107.0>,eee_sched_streams_sup,
>                   eee_sched_task_sup,eee_sched_sup,<0.2867.0>]
>     message_queue_len: 0
>     messages: []
>     links: [<0.3148.0>]
>     dictionary: []
>     trap_exit: false
>     status: running
>     heap_size: 6772
>     stack_size: 27
>     reductions: 58869
>   neighbours:
> 
> I'm about to turn on debug mode, but I don't think that that should be the
> answer to this kind of problem. Line numbers should come out by default.

In this case no line number can be presented since the callback module
returned a bad term, and it is when processing the return value that the
error is discovered.  In this case the bad action term should be presented
in the exception error (which it is from 21.0-rc1).


> 
> Cheers,
> Torben
> -- 
> https://www.linkedin.com/in/torbenhoffmann/


-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list