could someone help me figure out what to look for in this stacktrace? I've never touched Erlang, so I don't really know where to start.
We're using v19.09 of ejabberd, and getting this error log for many users:
2020-03-14 15:29:31.096 [error] <0.2029.48>#mod_http_api:handle:257 REST API Error: set_presence([{<<"user">>,<<"53265363">>},{<<"host">>,<<"chat.us.com">>},{<<"resource">>,<<"ssid-3465">>},{<<"type">>,<<"available">>},{<<"show">>,<<"chat">>},{<<"status">>,<<"{\"current_lobby_id\":\"none\",\"status\":\"{\\r\
\\t\\\"rich_presence\\\": \\\"{\\\\r\\\
\\\\t\\\\\\\"rich_presence\\\\\\\": \\\\\\\"?s=PlayerStatusInMap?p0=21?p1=2?p2=3\\\\\\\",\\\\r\\\
\\\\t\\\\\\\"session_id\\\\\\\": \\\\\\\"ssid-3465-38a44f60-9df7-4c79-8c8e-1cc99e5039dd\\\\\\\"\\\\r\\\
}\\\",\\r\
\\t\\\"current_lobby_id\\\": \\\"{\\\\r\\\
\\\\t\\\\\\\"lobby_id\\\\\\\": \\\\\\\"c791cfaa-9fd3-4d0d-9d5c-1aeb9efb12e2#hangouts.chat.us.com\\\\\\\",\\\\r\\\
\\\\t\\\\\\\"privacy\\\\\\\": \\\\\\\"friends_only\\\\\\\"\\\\r\\\
}\\\"\\r\
}\",\"region\":\"\"}">>},{<<"priority">>,<<"0">>}]) -> exit:{noproc,{p1_server,call,[none,{set_presence,{presence,<<>>,available,<<>>,{jid,<<"953265363">>,<<"chat.us.com">>,<<"oak/ssid-3465-1cc99e5039dd">>,<<"1953265363">>,<<"chat.us.com">>,<<"4c79-8c8e-1cc99e5039dd">>},{jid,<<"1953265363">>,<<"chat.us.com">>,<<>>,<<"1953265363">>,<<"chat.us.com">>,<<>>},chat,[{text,<<"en">>,<<"{\"current_lobby_id\":\"none\",\"status\":\"{\\r\
\\t\\\"rich_presence\\\": \\\"{\\\\r\\\
\\\\t\\\\\\\"rich_presence\\\\\\\": \\\\\\\"?s=PlayerStatusInMap?p0=21?p1=2?p2=3\\\\\\\",\\\\r\\\
\\\\t\\\\\\\"session_id\\\\\\\": \\\\\\\"ssid-348c8e-1cc99e5039dd\\\\\\\"\\\\r\\\
}\\\",\\r\
\\t\\\"current_lobby_id\\\": \\\"{\\\\r\\\
\\\\t\\\\\\\"lobby_id\\\\\\\": \\\\\\\"c791cfaa-9fd3-4d0d-9d5c-1aeb9efb12e2#hangouts.chat.us.com\\\\\\\",\\\\r\\\
\\\\t\\\\\\\"privacy\\\\\\\": \\\\\\\"friends_only\\\\\\\"\\\\r\\\
}\\\"\\r\
}\",\"region\":\"\"}">>}],0,[],#{}}},1000]}} [{p1_server,call,3,[{file,"src/p1_server.erl"},{line,210}]},{mod_http_api,handle2,4,[{file,"src/mod_http_api.erl"},{line,267}]},{mod_http_api,handle,4,[{file,"src/mod_http_api.erl"},{line,228}]},{mod_http_api,perform_call,4,[{file,"src/mod_http_api.erl"},{line,188}]},{mod_http_api,process,2,[{file,"src/mod_http_api.erl"},{line,141}]},{ejabberd_http,process,2,[{file,"src/ejabberd_http.erl"},{line,366}]},{ejabberd_http,process_request,1,[{file,"src/ejabberd_http.erl"},{line,488}]},{ejabberd_http,process_header,2,[{file,"src/ejabberd_http.erl"},{line,286}]}]
Start with the actual error, which is buried in the middle:
exit:{noproc,{p1_server,call,[none,{set_presence,.....
So there is a noproc error, which occurred during a call to p1_server:call, where the first argument is none. (The call would look like p1_server:call(none, {set_presence,...}).) That is, we're asking the process called none to execute the command set_presence, which fails because there is no process registered with the name none.
Now let's look at the stack trace. I added line breaks:
[{p1_server,call,3,[{file,"src/p1_server.erl"},{line,210}]},
{mod_http_api,handle2,4,[{file,"src/mod_http_api.erl"},{line,267}]},
{mod_http_api,handle,4,[{file,"src/mod_http_api.erl"},{line,228}]},
{mod_http_api,perform_call,4,[{file,"src/mod_http_api.erl"},{line,188}]},
{mod_http_api,process,2,[{file,"src/mod_http_api.erl"},{line,141}]},
{ejabberd_http,process,2,[{file,"src/ejabberd_http.erl"},{line,366}]},
{ejabberd_http,process_request,1,[{file,"src/ejabberd_http.erl"},{line,488}]},
{ejabberd_http,process_header,2,[{file,"src/ejabberd_http.erl"},{line,286}]}]
The first line is where it discovers that there is no such process, on line 210 in p1_server.erl. But we're more interested in why we're passing none as the argument in the first place. The stack trace suggests that's happening somewhere in mod_http_api.erl, but at that point I'm getting lost - it seems like it's extracting the arguments from the command, but I don't understand where the none is coming from...
This question is with reference to the question in the link:
"** exception error: undefined function add:addfunc/0 in Erlang "
I'm trying to execute a simple erlang program of adding two numbers. I'm trying to do this in Eclipse on Ubuntu 10.04 LTS.
When I execute this program, I'm getting the error as shown below:
-module(add).
-export([addfunc/0]).
addfunc() ->
6 + 5.
" ** exception error: undefined function add:addfunc/0 "
This program when executed in the erlang shell is working fine. But when it comes to eclipse it's giving me this error. Not this, any program for that matter is giving me the similar error. Guess I would be missing something about the eclipse configuration.
I haven't tested your code, but this very basic code should work.
The message says that your function does not exist.
Make sure that you have no errors at compile time.
Check whether your function is exported with:
add:module_info().
the result should look alike this:
[{module,add},
{exports,[{addfunc,0},
.....
I'm a meck (and Erlang) newbie and I'm struggling a bit with meck. I'm getting the following error:
=ERROR REPORT==== 27-Jan-2014::16:20:05 ===
Error in process <0.1825.0> with exit value: {{not_mocked,substatsDb},
[{meck_proc,gen_server,3,[{file,"src/meck_proc.erl"},{line,443}]},{meck_code_gen,exec,4,
[{file,"src/meck_code_gen.erl"},{line,147}]},{substats,loop,1,
[{file,"/Users/uyounri/gitsandbox/subpub/src/su...
At the beginning of my test I declare the module to be mocked:
meck:new(substats)
At the very end of my test the last thing I do is to unload the module that was mocked mocked:
meck:unload(substats)
The mocking seems to be working as expected until towards the end of the test when the above error is produced.
Thanks,
Rich
EDIT
Adding 2 ?debugFmt() lines seems to have fixed the problem; at least I no longer get the error. Here's the complete function that was modified:
stop(_) ->
meck:expect(substatsDb, stop, 1, fun(dbconn) -> ok end),
substats:stop(),
%% Note: this and the next ?debugFmt() calls prevent a meck
%% exit error. They both have to be present to prevent the error
?debugFmt("stop:~n", []),
meck:unload(substatsDb),
?debugFmt("stop: exit~n", []).
Have you tried adding the option passthrough when mocking the module?
meck:new(substatsDb, [passthrough])
Also, you are using the module "substatsDb" in the meck:expect call, but doing the meck:new for another module (substats), you should be doing everything for the same modules (new, expect, and unload)
hope it helps!
Today airbrake reported an exception. Its summary said that the problem occures when sidekiq tries retry the job after a failure. Here's what summary params look like:
{
"retry"=>"true",
"queue"=>"default",
"class"=>"AdwordsReportWorker",
"args"=>"[\"2\", \"2012-11-13\"]",
"jid"=>"51d568e46c412adc327153c8",
"error_message"=>"wrong number of arguments(1 for 0)",
"error_class"=>"ArgumentError",
"failed_at"=>"2012-11-14 13:56:12 UTC",
"retry_count"=>"0",
"controller"=>"",
"action"=>""
}
I seems that the exception is only taking palce when the job fails and retries. I would like to debug this, but I can't get my head around where to start :-(
My questions are:
Under what conditions worker understands it failed finishing the job (from which he descides to retry)? How do I force the worker to fail in attempt to, say, reproduce the problem?
Is there a good tutorial on debugging/examples sidekiq workers?
I am using sidekiq 2.3.3. Will upgrading to newer version solve the problem?
Bonus track.
The actual stacktrace unexpectedly ends up in
[GEM_ROOT]/gems/activerecord-3.2.8/lib/active_record/associations/association.rb:98:in `initialize'
I couldn't find how do debug sidekiq, but apperently the problem I am referring to is a known bug in Rails.
Here are a few lines:
https://github.com/mperham/sidekiq/issues/601
https://github.com/rails/rails/issues/7770