Age | Commit message (Collapse) | Author |
|
|
|
The encoding option was introduced in commit
270d909696a753af022df72a404c73f2895b4a02, to allow report callbacks to
format according to a given encoding. There was, however, no
connection between this encoding option, and the encoding of the
device to which the logger handler was writing.
Since a formatter is defined to return unicode:chardata(), and in
order to avoid mismatch with the encoding of the device, the encoding
option is now removed from the formatter. The handler itself must make
sure that it does not write illegal data to its device.
|
|
|
|
|
|
|
|
These are replaced by new config handling and must not be used any
more.
|
|
|
|
|
|
|
|
|
|
Add a few more tests to the proc_lib_SUITE.
|
|
The `error_logger_format_depth` variable is `unlimited` by default.
This can cause errors when logging crash reports using sasl logger,
because `io_lib:format("~P"...` does not support `unlimited` as a
depth parameter.
Use formatter string "~p" for unlimited depth.
A way to reproduce the error:
Start erl with sasl logger:
erl -boot start_sasl -sasl errlog_type error -sasl sasl_error_logger tty
Report arbitrary error:
error_logger:error_report(crash_report, [fake_crash_report, foo]).
|
|
|
|
|
|
The size of the message queue and the dictionary is limited in
crash reports.
To avoid creating the potentially huge list of messages of the message
queue, messages are received (if the Kernel variable
error_logger_format_depth is set).
The tag 'message_queue_len' has been added to the crash report.
|
|
proc_lib calls erlang:get_stacktrace/0 twice, which is unnecessary,
and potentially unsafe since there are calls to many functions
in between. Any of the calls could potentially cause and catch
an exception, invalidating the stacktrace.
Only call erlang:get_stacktrace/0 once, and pass the result to
the second place where it is needed.
|
|
This makes proc_lib behaves like a normal process as far
as the propagation of exceptions is concerned.
Before this commit, the following difference could be
observed:
6> spawn_link(fun() -> ssl:send(a,b) end).
<0.43.0>
7> flush().
Shell got {'EXIT',<0.43.0>,
{function_clause,
[{ssl,send,[a,b],[{file,"..."},{line,275}]}]}}
ok
8> proc_lib:spawn_link(fun() -> ssl:send(a,b) end).
<0.46.0>
9> flush().
Shell got {'EXIT',<0.46.0>,function_clause}
After this commit, we get the following instead:
3> flush().
Shell got {'EXIT',<0.61.0>,
{function_clause,
[{ssl,send,[a,b],[{file,"..."},{line,275}]},
{proc_lib,init_p,3,[{file,"..."},{line,232}]}]}}
The stacktrace will show minor differences of course
but the form is now the same as without proc_lib.
The rationale behind this commit is that:
* We now have a single form regardless of how the process
was started
* We can use the stacktrace to programmatically alter behavior
(for example an HTTP server identifying problems in input
decoding to send back a generic 400, or a 500 otherwise)
* We can access the stacktrace to print it somewhere (for
example an HTTP server could send it back to the client
when a debug mode is enabled)
|
|
Remove the restriction to only do the translation for
gen_server and gen_fsm. This enables user defined
gen based generic callback modules to be displayed nicely in
c:i() and observer.
|
|
The max_heap_size process flag can be used to limit the
growth of a process heap by killing it before it becomes
too large to handle. It is possible to set the maximum
using the `erl +hmax` option, `system_flag(max_heap_size, ...)`,
`spawn_opt(Fun, [{max_heap_size, ...}])` and
`process_flag(max_heap_size, ...)`.
It is possible to configure the behaviour of the process
when the maximum heap size is reached. The process may be
sent an untrappable exit signal with reason kill and/or
send an error_logger message with details on the process
state. A new trace event called gc_max_heap_size is
also triggered for the garbage_collection trace flag
when the heap grows larger than the configured size.
If kill and error_logger are disabled, it is still
possible to see that the maximum has been reached by
doing garbage collection tracing on the process.
The heap size is defined as the sum of the heap memory
that the process is currently using. This includes
all generational heaps, the stack, any messages that
are considered to be part of the heap and any extra
memory the garbage collector may need during collection.
In the current implementation this means that when a process
is set using on_heap message queue data mode, the messages
that are in the internal message queue are counted towards
this value. For off_heap, only matched messages count towards
the size of the heap. For mixed, it depends on race conditions
within the VM whether a message is part of the heap or not.
Below is an example run of the new behaviour:
Eshell V8.0 (abort with ^G)
1> f(P),P = spawn_opt(fun() -> receive ok -> ok end end, [{max_heap_size, 512}]).
<0.60.0>
2> erlang:trace(P, true, [garbage_collection, procs]).
1
3> [P ! lists:duplicate(M,M) || M <- lists:seq(1,15)],ok.
ok
4>
=ERROR REPORT==== 26-Apr-2016::16:25:10 ===
Process: <0.60.0>
Context: maximum heap size reached
Max heap size: 512
Total heap size: 723
Kill: true
Error Logger: true
GC Info: [{old_heap_block_size,0},
{heap_block_size,609},
{mbuf_size,145},
{recent_size,0},
{stack_size,9},
{old_heap_size,0},
{heap_size,211},
{bin_vheap_size,0},
{bin_vheap_block_size,46422},
{bin_old_vheap_size,0},
{bin_old_vheap_block_size,46422}]
flush().
Shell got {trace,<0.60.0>,gc_start,
[{old_heap_block_size,0},
{heap_block_size,233},
{mbuf_size,145},
{recent_size,0},
{stack_size,9},
{old_heap_size,0},
{heap_size,211},
{bin_vheap_size,0},
{bin_vheap_block_size,46422},
{bin_old_vheap_size,0},
{bin_old_vheap_block_size,46422}]}
Shell got {trace,<0.60.0>,gc_max_heap_size,
[{old_heap_block_size,0},
{heap_block_size,609},
{mbuf_size,145},
{recent_size,0},
{stack_size,9},
{old_heap_size,0},
{heap_size,211},
{bin_vheap_size,0},
{bin_vheap_block_size,46422},
{bin_old_vheap_size,0},
{bin_old_vheap_block_size,46422}]}
Shell got {trace,<0.60.0>,exit,killed}
|
|
|
|
|
|
We'll need a way to limit the size of the crash report produced
by proc_lib:format(). Add format/3, where the third argument is
a depth argument.
|
|
|
|
|
|
|
|
The new function utilizes sys:terminate.
|
|
|
|
Monitor the spawned process in proc_lib:start/[3|4|5], so
that a proper error is returned, if the spawned process crashes
before proclib:init_ack/1 is sent.
Previously the calling process would hang forever or until specified
timeout. Start link catches these errors but start did not.
start now behaves as start_link if process traps exit.
|
|
|
|
* ks/dialyzer:
dialyzer: Build the PLT even if there are unresolved remote types
proplists: Export the type property()
erl_lint: Issue warnings for undefined exported types
Minor fix in a print message
Add handling of unknown types
Add declaration for exported types
Add types and specs; performed some cleanups also
erl_scan: Add declarations for exported types
stdlib: Add declarations for exported types
hipe: Add declarations for exported types
compiler: Add declarations for exported types
syntax_tools: Add declarations for exported types
kernel: Add declaration for exported types
Support -export_type() in dialyzer and erl_types
Add infrastructure for the -export_type() attribute
OTP-8678 ks/dialyzer
|
|
|
|
|