Hi all..!
I created a file named mod_post_log.erl that encrypts xmpp messages and get decoded on the other side using php. When I uploaded this file on server . The server started restarting again and again. I got the following error in the error log of ejabberd :
{{badmatch,{xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"to">>,<<"aaaa@xxxx.com">>},{<<"from">>,<<"bbbb@xxx.com">>},{<<"id">>,<<"tVuhkU1FCW">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"{\n \"packetId\" : \"pYyYk-67\",\n \"publicKey\" : \"ftghGfMA0GdqGSIb3DQEBAsdfgUAA4GNADCBiQKBasdfg4JE#NLnhh3InKTaQIDAQAB\"\n}">>}]},{xmlel,<<"subject">>,[],[{xmlcdata,<<"request_message">>}]},{xmlel,<<"request">>,[{<<"xmlns">>,<<"urn:xmpp:receipts">>}],[]}]}},[{mod_post_log,log_packet,3,[{file,"src/mod_post_log.erl"},{line,49}]},{mod_post_log,log_user_send,4,[{file,"src/mod_post_log.erl"},{line,37}]},{ejabberd_hooks,safe_apply,3,[{file,"src/ejabberd_hooks.erl"},{line,382}]},{ejabberd_hooks,run_fold1,4,[{file,"src/ejabberd_hooks.erl"},{line,365}]},{ejabberd_c2s,session_established2,2,[{file,"src/ejabberd_c2s.erl"},{line,1296}]},{p1_fsm,handle_msg,10,[{file,"src/p1_fsm.erl"},{line,582}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}
running hook: {user_send_packet,[{state,{socket_state,p1_tls,{tlssock,#Port<0.15138>,#Port<0.15140>},<0.4595.1>},ejabberd_socket,#Ref<0.0.7.121047>,false,<<"3221951772">>,undefined,c2s,c2s_shaper,false,true,false,true,[verify_none,compression_none,{protocol_options,<<"no_sslv3">>},{certfile,<<"/opt/ejabberd-15.11/conf/server.pem">>}],true,{jid,<<"447894195040">>,<<"xxxx.com">>,<<"i-1023-503">>,<<"447894195040">>,<<"xxxx.com">>,<<"i-1023-503">>},<<"447894195040">>,<<"xxxx.com">>,<<"i-1023-503">>,{{1487,836226,953691},<0.4596.1>},{255,{{<<"919029084044">>,<<"xxxx.com">>,<<>>},{{<<"916029401855">>,<<"xxxxx.com">>,<<>>},{{<<"447891288045">>,<<"xxxxxx.com">>,<<>>},{{<<"447545597180">>,<<"xxxx.com">>,<<>>},{{<<"3556303758005">>,<<"xxxxxx.com">>,<<>>},{{<<"16476418521">>,<<"xxxxx.com">>,<<>>},{{<<"09920714338">>,<<"xxxx.com">>,<<>>},{{<<"07666205801">>,<<"xxxxx.com">>,<<>>},nil,nil},{{<<"11221230000225">>,<<"xxxxx.com">>,<<>>},nil,nil}},{{<<"254721391599">>,<<"xxxx.com">>,<<>>},{{<<"19179934855">>,<<"xxxx.com">>,<<>>},nil,nil},{{<<"3365234751">>,<<"xxx.com">>,<<>>},nil,nil}}},{{<<"441111111111">>,<<"xxx.com">>,<<>>},{{<<"35795125788">>,<<"xxxx.com">>,<<>>},{{<<"3556452587542">>,<<"xxxx.com">>,<<>>},nil,nil},{{<<"3765780448988">>,<<"xxxxx.com">>,<<>>},nil,nil}},{{<<"4422222222">>,<<"xxxx.com">>,<<>>},{{<<"441342717702">>,<<"xxxx.com">>,<<>>},nil,nil},{{<<"447445239446">>,<<"xxxx.com">>,<<>>},nil,nil}}}},{{<<"447786058446">>,<<"xxxx.com">>,<<>>},{{<<"447767756535">>,<<"xxxx.com">>,<<>>},{{<<"447708688713">>,<<".com">>,<<>>},{{<<"447545597339">>,<<"xxxx.com">>,<<>>},nil,nil},{{<<"447716897132">>,<<"xxxx.com">>,<<>>},nil,nil}},{{<<"447774213837">>,<<"xxxx.com">>,<<>>},{{<<"447771757625">>,<<"xxxx.com">>,<<>>},nil,nil},{{<<"447774213867">>,<<"xxxxx.com">>,<<>>},nil,nil}}},{{<<"447813436762">>,<<"xxxx.com">>,<<>>},{{<<"447791216424">>,<<"xxxx.com">>,<<>>},{{<<"447790900304">>,<<"xxxx.com">>,<<>>},nil,nil},{{<<"447807152328">>,<<"xxxxx.com">>,<<>>},nil,nil}},{{<<"447845608191">>,<<"e.com">>,<<>>},{{<<"447817334816">>,<<"xxxx.com">>,<<>>},nil,nil},{{<<"447878992110">>,<<"xxxx.com">>,<<>>},nil,nil}}}}},{{<<"911111122222">>,<<"xxxx.com">>,<<>>},{{<<"447980632528">>,<<"xxxxx.com">>,<<>>},{{<<"447930676827">>,<<"xxxx.com">>,<<>>},{{<<"447904068366">>,<<"xxxx.com">>,<<>>},{{<<"447894195040">>,<<"xxxx.com">>,<<>>},nil,nil},{{<<"447904352732">>,<<"xxxx.com">>,<<>>},nil,nil}},{{<<"447966709324">>,<<"xxx.com">>,<<>>},{{<<"447960325498">>,<<"xxxx.com">>,<<>>},nil,nil},{{<<"447979505573">>,<<"xxxx.com">>,<<>>},...}}},...},...}},...},...}},...},...]}
I am having difficulty in understanding this error message. Please help me to understand it and possibly solve this error..
I don't see why the server
I don't see why the server would restart just for having that badmatch problem.
That error means that in this function, in that line:
[{mod_post_log,log_packet,3,[{file,"src/mod_post_log.erl"},{line,49}]}
you have an assigment (a match) like
a = b
but obviously b doesn't match a.
In your case the code may be more complicated, like:
A=a,
A=b,
or:
{ok, Value} = {xmlel, a, b, c}.