[erlang-questions] No backtrace on errors in cowboy
Aleksandr Vinokurov
aleksandr.vin@REDACTED
Tue Jul 17 20:09:16 CEST 2012
Hello all,
I need to see a backtrace of a cowboy_http_protocol:request/2 and to get it
I've added some code in the function (marked strong):
request(_Any, State) ->
%%%%%%%%%
* io:format("~n~p~n", [{xxxxx161, State, _Any}]),*
* try*
* erlang:error(xxxxx161_error)*
* catch*
* error:X ->*
* io:format("~nxxxxx161_error stacktrace~n~p~n",
[erlang:get_stacktrace()]),*
* erlang:error(X)*
* end,*
*%%%%%%%%%%%*
error_terminate(400, State).
After recompilation and reloading I see only one line in backtrace list:
(web@REDACTED)1>
{xxxxx161,
{state,<0.85.0>,#Port<0.3809>,cowboy_tcp_transport,
[{'_',
[{[<<"token">>],
ps_oauth_2_api_external_token_endpoint,
[{config,off,off,
{{127,0,0,1},8080},
{{127,0,0,1},8180},
{{127,0,0,1},8443},
{{127,0,0,1},8543},
[{"jay","123"},"bob",{"matt","321"}],
"http://127.0.0.1:8881/client-storage",
[{<<"apt1">>,{seconds,600,"600"}},
{<<"apt2">>,{seconds,6000,"6000"}}],
{seconds,3600,"3600"},
{seconds,600,"600"},
undefined,
{bytes,64},
{bytes,256},
{bytes,1024}},
{external_api_applications,ps_oauth_2_ext_api_applications}]},
{'_',ps_oauth_2_index,[external,#Fun<ps_oauth_2.2.99090327>]}]}],
{ps_oauth_2_api_external_token_endpoint,
[{config,off,off,
{{127,0,0,1},8080},
{{127,0,0,1},8180},
{{127,0,0,1},8443},
{{127,0,0,1},8543},
[{"jay","123"},"bob",{"matt","321"}],
"http://127.0.0.1:8881/client-storage",
[{<<"apt1">>,{seconds,600,"600"}},
{<<"apt2">>,{seconds,6000,"6000"}}],
{seconds,3600,"3600"},
{seconds,600,"600"},
undefined,
{bytes,64},
{bytes,256},
{bytes,1024}},
{external_api_applications,ps_oauth_2_ext_api_applications}]},
undefined,undefined,
{#Fun<cowboy_http.urldecode.2>,crash},
0,5,213,infinity,4096,5000,
<<"authorization: Basic YXBwMToxMjM=\r\nconnection:
keep-alive\r\n\r\ngrant_type=authorization_code&code=1pD8tsKZTFXw3sbbOPbLtCU0oSg5CWx%2FohR8AC%2BAuTROzsx1DQC6LLm4h6iaOvupV5cOs3cAqBqsWB%2BtzfxVtg%3D%3D">>,
false,infinity,undefined},
{http_error,<<"7.0.0.1:8080\r\n">>}}
(web@REDACTED)1>
xxxxx161_error stacktrace
[{cowboy_http_protocol,request,2,
[{file,"src/cowboy_http_protocol.erl"},{line,172}]}]
(web@REDACTED)1>
=ERROR REPORT==== 17-Jul-2012::21:51:26 ===
Error in process <0.1373.0> on node 'web@REDACTED' with exit value:
{xxxxx161_error,[{cowboy_http_protocol,request,2,[{file,"src/cowboy_http_protocol.erl"},{line,176}]}]}
=SUPERVISOR REPORT==== 17-Jul-2012::21:51:26 ===
Supervisor: {<0.86.0>,cowboy_requests_sup}
Context: child_terminated
Reason: {xxxxx161_error,
[{cowboy_http_protocol,request,2,
[{file,"src/cowboy_http_protocol.erl"},
{line,176}]}]}
Offender: [{pid,<0.1373.0>},
{name,cowboy_requests_sup},
{mfargs,{cowboy_requests_sup,start_request,undefined}},
{restart_type,temporary},
{shutdown,brutal_kill},
{child_type,worker}]
If I call that code in shell I see a full backtrace like that:
(web@REDACTED)4> try
erlang:error(xxxxxREQ_error)
catch
error:_ ->
io:format("~nxxxxxREQ_error stacktrace~n~p~n",
[erlang:get_stacktrace()])
end.
xxxxxREQ_error stacktrace
[{erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,576}]},
{erl_eval,try_clauses,8,[{file,"erl_eval.erl"},{line,767}]},
{shell,exprs,7,[{file,"shell.erl"},{line,668}]},
{shell,eval_exprs,7,[{file,"shell.erl"},{line,623}]},
{shell,eval_loop,3,[{file,"shell.erl"},{line,608}]}]
ok
(web@REDACTED)5>
I don't understand what am I doing wrong.
--
Александр Винокуров
+7 (921) 982-21-43
@aleksandrvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120717/be1844e3/attachment.htm>
More information about the erlang-questions
mailing list