Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

falls when there is no connection #84

Open
heiheshang opened this issue Aug 25, 2019 · 3 comments
Open

falls when there is no connection #84

heiheshang opened this issue Aug 25, 2019 · 3 comments

Comments

@heiheshang
Copy link

crasher: initial call: emqtt:init/1, pid: <0.6626.0>, registered_name: [], exit: {{noproc,{gen_statem,call,[<0.6621.0>,ping,infinity]}},[{gen_statem,loop_receive,3,[{file,"gen_statem.erl"},{line,894}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}, ancestors: [scanner_server,scanner_sup,<0.293.0>], message_queue_len: 0, messages: [], links: [], dictionary: [], trap_exit: true, status: running, heap_size: 6772, stack_size: 27, reductions: 13462; neighbours:
falls when there is no connection.why it falls when there is no connection? why it is impossible to give the user the option of handling this situation?

@gilbertwong96
Copy link
Contributor

gilbertwong96 commented Aug 25, 2019 via email

@heiheshang
Copy link
Author

MQTT=case emqtt:start_link([{owner,self()},{msg_handler,make_msg_handler()}|EConfig]) of {ok, C2} -> case emqtt:connect(C2) of {ok, _Props} -> mqtt_subscribe(C2), erlang:send_after(1000, self(), {tick_1s,C2}), erlang:send_after(5000, self(), {tick_5s,C2}), C2; ErrCon -> erlang:send_after(1000, self(), open_mqtt), logger:error("mqtt connect error ~p",[ErrCon]), {mqtt,no_conected} end; Error -> erlang:send_after(1000, self(), open_mqtt), logger:error("mqtt link error ~p",[Error]), {mqtt,no_conected} end, {mqtt,MQTT}; Error -> logger:error("MQTT ~s",[Error]), {mqtt,no_conected}
case emqtt:ping(MQTT) of pong -> print_ping(Win,State#state.ping), NewState=State#state{ping=get_ping(State#state.ping)}, erlang:send_after(1000, self(), {tick_1s,MQTT}); _ -> print_ping(Win,<<"!">>), erlang:send_after(1000, self(), open_mqtt), NewState=State#state{ping= <<"!">>} end,

@heiheshang
Copy link
Author

** Reason for termination == , ** {{{shutdown,tcp_closed},{gen_statem,call,[<0.7627.0>,ping,infinity]}},[{gen,do_call,4,[{file,"gen.erl"},{line,177}]},{gen_statem,call_dirty,4,[{file,"gen_statem.erl"},{line,598}]},
before sending messages, I ping, if the connection is broken, then everything drops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants