<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Thanks for the reply. I’m having an issue getting the full report because lager is truncating it. Will the stack trace help?
<div><br /></div>
<div>
<div>Stacktrace: [{gen_statem,parse_event_result,8,[{file,"gen_statem.erl"},{line,1267}]},{gen_statem,loop_event,6,[{file,"gen_statem.erl"},{line,1015}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]</div>
</div>
<div><br /></div>
<div>But the process is exiting on this line:</div>
<blockquote style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">
<div>
<div>handle_event(state_timeout, _Msg, StateName, State) ->                                                                                                                                                                                                                                                                ?LOG(warning, "STATE TIMEOUT(State:~p)", [StateName], State),                                                                                                                                                                                                                                                    </div>
</div>
<div>
<div>{stop, timeout};    <- This line</div>
</div>
</blockquote>
<div><br /></div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
On Aug 15, 2018, 9:45 AM -0400, Raimo Niskanen <raimo+erlang-questions@erix.ericsson.se>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">On Tue, Aug 07, 2018 at 03:05:08PM -0400, Code Wiget wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">Would like to update this to say that I’m using {state_timeout, 2000, timeout}, rather than {state_timeout, 2000}<br />
<br />
On Aug 7, 2018, 2:29 PM -0400, Code Wiget <codewiget95@gmail.com>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #3498db;">Hi everyone,<br />
<br />
How do you gracefully exit from a state_timeout in a gen_statem? Generally, for a gen_statem, I can return “stop” or {stop, Reason} from a state function and the statem will terminate. However, if I use a state timeout method, returned from init:<br />
<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #d35400;">{ok, new_state, State, {state_timeout, 2000}}<br /></blockquote>
<br />
The new_state(state_timeout, Info, State) method is called after 2000. Returning “stop” from this given an error…:<br />
<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #d35400;">18:22:33.039 [error] <0.576.0> :  Lager event handler error_logger_lager_h exited with reason {'EXIT',{{badmatch,[smdpp_proxy,{state_timeout,timeout},[{data,[{"State",{awaiting_<br /></blockquote>
</blockquote>
</blockquote>
<br />
Can you post the whole printout?<br />
The truncation hides where the process has crashed.<br />
<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #3498db;">
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #d35400;"><br /></blockquote>
What can I return from this function to gracefully exit? Can this be done with state_timeout? If this is an obvious question, please point me in the right direction. The documentation here:http://erlang.org/doc/man/gen_statem.html doesn’t seem to mention any return from the state_timeout.<br />
<br />
Thanks!<br />
<br />
<br /></blockquote>
</blockquote>
<br />
--<br />
<br />
/ Raimo Niskanen, Erlang/OTP, Ericsson AB<br /></blockquote>
<div></div>
</div>
</body>
</html>