[erlang-questions] gen_statem 20.3 init/1 - {next_event, internal, initial_event}

Peter Morgan peter.james.morgan@REDACTED
Thu Mar 15 12:23:20 CET 2018

Hello -

I am sure I am doing something daft. I picked up 20.3 this morning and have some gen_statem code that previously worked in 20.2.4:



start() ->
    gen_statem:start({local, ?MODULE}, ?MODULE, [], []).

init([]) ->
     {next_event, internal, initial_event}}.

callback_mode() ->

handle_event(Type, Event, State, Data) ->
    error_logger:info_report([{type, Type},
                              {event, Event},
                              {state, State},
                              {data, Data}]),

brew switch erlang 20.2.4

Erlang/OTP 20 [erts-9.2.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V9.2.1  (abort with ^G)
1> ex1:start().

=INFO REPORT==== 15-Mar-2018::12:13:29 ===
    type: internal
    event: initial_event
    state: initial_state
    data: initial_data

brew switch erlang 20.3
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V9.3  (abort with ^G)
1> c(ex1).
2> ex1:start().
=ERROR REPORT==== 15-Mar-2018::12:15:02 ===
** State machine ex1 terminating
** Last event = {internal,init_state}
** When server state  = {initial_state,initial_data}
** Reason for termination = error:{bad_action_from_state_function,
** Callback mode = handle_event_function
** Stacktrace =
**  [{gen_statem,parse_actions_next_event,7,

The docs seem to indicate that next_event remains valid on init/1 - http://erlang.org/doc/man/gen_statem.html#type-init_result <http://erlang.org/doc/man/gen_statem.html#type-init_result>.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180315/8cd3df37/attachment.htm>

More information about the erlang-questions mailing list