What does this ejabberd / erlang stack trace mean? - erlang

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...

Related

Ruby gem origami sign signature failed

I'm trying to make the PDF file with signature with origami gem, follow this example https://github.com/gdelugre/origami/blob/master/examples/signature/signature.rb
Now i just run this signature.rb and got error
[error] Breaking on: ">>\nendobj\n..." at offset 0x1f6f3
[error] Last exception: [Origami::InvalidObjectError] Failed to parse object (no:43,gen:0) -> [ArgumentError] wrong number of arguments (given 1, expected 0; required keyword: year)
I have no idea to move forward :'<
I also found the sign method of gem at https://github.com/gdelugre/origami/blob/master/lib/origami/signature.rb, and have take a look, I can't find any specific things to do :'<
Might this example is outdate?
The error message is known see https://github.com/gdelugre/origami/issues/80
A fix should be available https://github.com/gdelugre/origami/pull/74/commits
But has not been added so use newer file from the fork https://github.com/pocke/origami/tree/fix-ruby-2.7-kwargs-warnings
Specifically you need this updated file and may need to follow any other suggestions from above.
https://github.com/pocke/origami/raw/fix-ruby-2.7-kwargs-warnings/lib/origami/filters/predictors.rb
However it always worth looking for a fork with many more recent improvements such as
https://github.com/joelsondrew/origami

Elixir GenServer no process

I'm following this tutorial and I've double and triple checked the code compared to the tutorial and their GH repo and I can't figure out why I'm getting this error when running mix test
I'm pretty green when it comes to Elixir so I'm not terribly good at debugging yet so please excuse me if this is super simple
board_server.ex Gist
game_of_life.ex Gist
And my test file
defmodule GameOfLife.BoardServerTest do
use ExUnit.Case
doctest GameOfLife.BoardServer
end
The error I'm getting is:
test/board_server_test.exs:3
** (exit) exited in: GenServer.call({:global, GameOfLife.BoardServer}, {:start_game, 1000}, 5000)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
stacktrace:
(elixir) lib/gen_server.ex:729: GenServer.call/3
(for doctest at) lib/game_of_life/board_server.ex:121: (test)
Thank you in advance
This error states that the server is not started. You can start it with the GameOfLife.BoardServer.start_link function.
In short, you should start your server with GenServer#start or GenServer#start_link functions.
GenServer docs

Read a list from stream using Yap-Prolog

I want to run a (python3) process from my (yap) prolog script and read its output formatted as a list of integers, e.g. [1,2,3,4,5,6].
This is what I do:
process_create(path(python3),
['my_script.py', MyParam],
[stdout(pipe(Out))]),
read(Out, OutputList),
close(Out).
However, it fails at read/2 predicate with the error:
PL_unify_term: PL_int64 not supported
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe
I am sure that I can run the process correctly because with [stdout(std)] parameter given to process_create the program outputs [1,2,3,4,5,6] as expected.
Weird thing is that when I change the process to output some constant term (as constant_term) it still gives the same PL_int64 error. Appending a dot to the process' output ([1,2,3,4,5,6].) doesn't solve the error. Using read_term/3 gives the same error. read_string/3 is undefined in YAP-Prolog.
How can I solve this problem?
After asking at the yap-users mailing list I got the solution.
Re-compiled YAP Prolog 6.2.2 with libGMP option and now it works. It may also occur in 32-bit YAP.

Lua: How to call error without stack trace

I'm using Lua to parse scripts written in some language (let's call it L) and create Lua-code that can be run by e.g. LuaJIT. But to simplify debugging for the users, I want to map the run time errors given by Lua/LuaJIT to the correct line in the L-files. I do this by xpcalling the created Lua-code, translating the error message and stacktrace and then calling error with this message. Unfortunately this gives me two stack traces, one created by me and one tracing back to the function that called error. Is it possible to get rid of this stack trace, or is there some better way of doing this?
local status, err = xpcall(loadedCode, debug.traceback)
if not status then
error(createANewErrorMessageWithPrettyTraceback(err),0)
end
Output:
luajit: ./my/file.name:5: Some error message
stack traceback:
my pretty traceback
stack traceback:
[C]: in function 'error'
./my/file/calling/error.lua:44: in function <./my/file/calling/error.lua:26>
./my-main:16: in main chunk
[C]: at 0x00404180
I know that e.g. Moonscript does something similar to this, but as far as I can see they just write the new error message to stderr and then continues as normal, instead of stopping the program which is what I want to do.
There is a possibility of doing this and then calling error with no arguments, which will make the program fail (actually I think it's error that fails), but this feels like quite an ugly solution, so I'll rather keep the stupid second trace than doing that.
PS: I assume what the title asks actually doesn't work (as error only takes two arguments), so what I'm actually asking is more how something like this can be achieved. (Are there other functions that do similar things perhaps, or where I should look to figure out how to write that function myself.)
Edit: Is it perhaps possible to edit the function that error's using to get its traceback, as it is with debug.traceback?
I wanted to do something similar (only from Lua directly) and I ended up overwriting debug.traceback function itself to change the stack trace to suit my needs. My code is below; see if this method works for you as well:
local dtraceback = debug.traceback
debug.traceback = function (...)
if select('#', ...) >= 1 then
local err, lvl = ...
if err and type(err) ~= 'thread' then
local trace = dtraceback(err, (lvl or 2)+1)
if genv.print == iobase.print then -- no remote redirect
return trace
else
genv.print(trace) -- report the error remotely
return -- don't report locally to avoid double reporting
end
end
end
-- direct call to debug.traceback: return the original.
-- debug.traceback(nil, level) doesn't work in Lua 5.1
-- (http://lua-users.org/lists/lua-l/2011-06/msg00574.html), so
-- simply remove first frame from the stack trace
return (dtraceback(...):gsub("(stack traceback:\n)[^\n]*\n", "%1"))
end
You could simply display the modified traceback that you want and exit.
local function errh(err)
print(createANewErrorMessageWithPrettyTraceback(debug.traceback(err, 2)))
os.exit(-1) -- error code
end
local status, result = xpcall(loadedCode, errh)
-- The script will never reach this point if there is an error.
print(result)

Magento - Fatal error: Maximum function nesting level of '100' reached, aborting

I don't know what is causing this error. I was working on a custom module on my Magento store and didn't check the homepage of the store regularly. Out of the blue today I am getting this error on my homepage.
Fatal error: Maximum function nesting level of '100' reached, aborting! in C:\Program Files\EasyPHP-5.3.8.0\www\indieswebs\lib\Zend\Db\Adapter\Pdo\Mysql.php on line 1045
The funny thing is there is NO 1045 line number in this file! So I am guessing it's some sort of looping error. But I don't know what is causing it. Can anyone help me figure out what might be causing this particular error and how can I remove it?
Edit:I deleted the cache from the store and reloaded the homepage. The error has changed now. It says:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 261904 bytes) in C:\Program Files\EasyPHP-5.3.8.0\www\indieswebs\lib\Zend\Db\Select.php on line 281
Does anyone know how to resolve this?
The error only come when you installed xdebug.
Use following setting in php.ini
xdebug.max_nesting_level = 200
I was able to resolve a related issue (that causes the same error message) by checking the files in [webroot]/app/etc/
It was happening (on enterprise edition) because
config.xml
enterprise.xml
were missing from that directory. Once I put them back, that fixed this problem.
I also read elsewhere that a malformed local.xml might cause this issue.
On enterprise edition, use something like:
<default_setup>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[some_user]]></username>
<password><![CDATA[some_pass]]></password>
<dbname><![CDATA[database_name]]></dbname>
<active>1</active>
</connection>
</default_setup>
On CE, use something like:
<default_setup>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[your_user]]></username>
<password><![CDATA[your_pass]]></password>
<dbname><![CDATA[your_db]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
</connection>
</default_setup>
I got this in my Collection.php model, and the culprit turned out to be the call to parent::__construct(). Once I remmed it out the error went away. PS: Raising xdebug nesting level limit did not work.

Resources