aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/doc/src/heart.xml11
-rw-r--r--lib/kernel/doc/src/notes.xml181
-rw-r--r--lib/kernel/test/heart_SUITE.erl40
-rw-r--r--lib/kernel/test/inet_SUITE.erl23
-rw-r--r--lib/kernel/test/inet_res_SUITE.erl15
5 files changed, 77 insertions, 193 deletions
diff --git a/lib/kernel/doc/src/heart.xml b/lib/kernel/doc/src/heart.xml
index c587e39345..864f8facac 100644
--- a/lib/kernel/doc/src/heart.xml
+++ b/lib/kernel/doc/src/heart.xml
@@ -83,6 +83,17 @@
<c><![CDATA[SIGKILL]]></c>:</p>
<pre>
% <input>erl -heart -env HEART_KILL_SIGNAL SIGABRT ...</input></pre>
+ <p> If heart should <b>not</b> kill the Erlang runtime system, this can be indicated
+ using the environment variable <c><![CDATA[HEART_NO_KILL=TRUE]]></c>.
+ This can be useful if the command executed by heart takes care of this,
+ for example as part of a specific cleanup sequence.
+ If unset, or not set to <c><![CDATA[TRUE]]></c>, the default behaviour
+ will be to kill as described above.
+ </p>
+
+ <pre>
+% <input>erl -heart -env HEART_NO_KILL 1 ...</input></pre>
+
<p>Furthermore, <c><![CDATA[ERL_CRASH_DUMP_SECONDS]]></c> has the
following behavior on <c>heart</c>:</p>
<taglist>
diff --git a/lib/kernel/doc/src/notes.xml b/lib/kernel/doc/src/notes.xml
index b0e614d33c..d0540768de 100644
--- a/lib/kernel/doc/src/notes.xml
+++ b/lib/kernel/doc/src/notes.xml
@@ -31,187 +31,6 @@
</header>
<p>This document describes the changes made to the Kernel application.</p>
-<section><title>Kernel 5.0</title>
-
- <section><title>Fixed Bugs and Malfunctions</title>
- <list>
- <item>
- <p>The handling of <c>on_load</c> functions has been
- improved. The major improvement is that if a code upgrade
- fails because the <c>on_load</c> function fails, the
- previous version of the module will now be retained.</p>
- <p>
- Own Id: OTP-12593</p>
- </item>
- <item>
- <p><c>rpc:call()</c> and <c>rpc:block_call()</c> would
- sometimes cause an exception (which was not mentioned in
- the documentation). This has been corrected so that
- <c>{badrpc,Reason}</c> will be returned instead.</p>
- <p>
- Own Id: OTP-13409</p>
- </item>
- <item>
- <p>On Windows, for modules that were loaded early (such
- as the <c>lists</c> module), <c>code:which/1</c> would
- return the path with mixed slashes and backslashes, for
- example: <c>"C:\\Program
- Files\\erl8.0/lib/stdlib-2.7/ebin/lists.beam"</c>. This
- has been corrected.</p>
- <p>
- Own Id: OTP-13410</p>
- </item>
- <item>
- <p>
- Use fsync instead of fdatasync on Mac OSX.</p>
- <p>
- Own Id: OTP-13411</p>
- </item>
- <item>
- <p>
- The default chunk size for the fallback sendfile
- implementation, used on platforms that do not have a
- native sendfile, has been decreased in order to reduce
- connectivity issues.</p>
- <p>
- Own Id: OTP-13444</p>
- </item>
- <item>
- <p>
- Huges writes (2Gb or more) could fail on some Unix
- platforms (for example, OS X and FreeBSD).</p>
- <p>
- Own Id: OTP-13461</p>
- </item>
- <item>
- <p>
- A bug has been fixed where the DNS resolver inet_res did
- not refresh its view of the contents of for example
- resolv.conf immediately after start and hence then failed
- name resolution. Reported and fix suggested by Michal
- Ptaszek in GitHUB pull req #949.</p>
- <p>
- Own Id: OTP-13470 Aux Id: Pull #969 </p>
- </item>
- <item>
- <p>
- Fix process leak from global_group. Thanks to Xuming who
- reported and fixed this!</p>
- <p>
- Own Id: OTP-13516 Aux Id: PR-1008 </p>
- </item>
- <item>
- <p>
- The function <c>inet:gethostbyname/1</c> now honors the
- resolver option <c>inet6</c> instead of always looking up
- IPv4 addresses.</p>
- <p>
- *** POTENTIAL INCOMPATIBILITY ***</p>
- <p>
- Own Id: OTP-13622 Aux Id: PR-1065 </p>
- </item>
- <item>
- <p>
- The <c>Status</c> argument to <c>init:stop/1</c> is now
- sanity checked to make sure <c>erlang:halt</c> does not
- fail.</p>
- <p>
- Own Id: OTP-13631 Aux Id: PR-911 </p>
- </item>
- </list>
- </section>
-
-
- <section><title>Improvements and New Features</title>
- <list>
- <item>
- <p>
- Added <seealso
- marker="kernel:os#perf_counter/1">os:perf_counter/1</seealso>.</p>
- <p>
- The perf_counter is a very very cheap and high resolution
- timer that can be used to timestamp system events. It
- does not have monoticity guarantees, but should on most
- OS's expose a monotonous time.</p>
- <p>
- Own Id: OTP-12908</p>
- </item>
- <item>
- <p>
- The os:cmd call has been optimized on unix platforms to
- be more performant as the number of schedulers increase.</p>
- <p>
- Own Id: OTP-13089</p>
- </item>
- <item>
- <p>New functions that can load multiple functions at once
- have been added to the '<c>code</c>' module. The
- functions are <c>code:atomic_load/1</c>,
- <c>code:prepare_loading/1</c>,
- <c>code:finish_loading/1</c>, and
- <c>code:ensure_modules_loaded/1</c>.</p>
- <p>
- Own Id: OTP-13111</p>
- </item>
- <item>
- <p>
- The code path cache feature turned out not to be very
- useful in practice and has been removed. If an attempt is
- made to enable the code path cache, there will be a
- warning report informing the user that the feature has
- been removed.</p>
- <p>
- Own Id: OTP-13191</p>
- </item>
- <item>
- <p>When an attempt is made to start a distributed Erlang
- node with the same name as an existing node, the error
- message will be much shorter and easier to read than
- before. Example:</p>
- <p><c>Protocol 'inet_tcp': the name somename@somehost
- seems to be in use by another Erlang node</c></p>
- <p>
- Own Id: OTP-13294</p>
- </item>
- <item>
- <p>
- The output of the default error logger is somewhat
- prettier and easier to read. The default error logger is
- used during startup of the OTP system. If the start-up
- fails, the output will be easier to read.</p>
- <p>
- Own Id: OTP-13325</p>
- </item>
- <item>
- <p>The functions <c>rpc:safe_multi_server_call/2,3</c>
- that were deprecated in R12B have been removed.</p>
- <p>
- *** POTENTIAL INCOMPATIBILITY ***</p>
- <p>
- Own Id: OTP-13449</p>
- </item>
- <item>
- <p>
- Update the error reasons in dist_util, and show them in
- the logs if net_kernel:verbose(1) has been called.</p>
- <p>
- Own Id: OTP-13458</p>
- </item>
- <item>
- <p>
- Experimental support for Unix Domain Sockets has been
- implemented. Read the sources if you want to try it out.
- Example: <c>gen_udp:open(0,
- [{ifaddr,{local,"/tmp/socket"}}])</c>. Documentation will
- be written after user feedback on the experimental API.</p>
- <p>
- Own Id: OTP-13572 Aux Id: PR-612 </p>
- </item>
- </list>
- </section>
-
-</section>
-
<section><title>Kernel 4.2</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/kernel/test/heart_SUITE.erl b/lib/kernel/test/heart_SUITE.erl
index 548b27db97..e63ed34973 100644
--- a/lib/kernel/test/heart_SUITE.erl
+++ b/lib/kernel/test/heart_SUITE.erl
@@ -29,11 +29,11 @@
set_cmd/1, clear_cmd/1, get_cmd/1,
callback_api/1,
options_api/1,
- dont_drop/1, kill_pid/1]).
+ dont_drop/1, kill_pid/1, heart_no_kill/1]).
-export([init_per_testcase/2, end_per_testcase/2]).
--export([start_heart_stress/1, mangle/1, suicide_by_heart/0]).
+-export([start_heart_stress/1, mangle/1, suicide_by_heart/0, non_suicide_by_heart/0]).
-define(DEFAULT_TIMEOUT_SECS, 120).
@@ -491,6 +491,30 @@ do_kill_pid(_Config) ->
false
end.
+
+heart_no_kill(suite) ->
+ [];
+heart_no_kill(doc) ->
+ ["Tests that heart doesn't kill the old erlang node when ",
+ "HEART_NO_KILL is set."];
+heart_no_kill(Config) when is_list(Config) ->
+ ok = do_no_kill(Config).
+
+do_no_kill(_Config) ->
+ Name = heart_test,
+ {ok,Node} = start_node_run(Name,[],non_suicide_by_heart,[]),
+ io:format("Node is ~p~n", [Node]),
+ ok = wait_for_node(Node,15),
+ io:format("wait_for_node is ~p~n", [ok]),
+ erlang:monitor_node(Node, true),
+ receive {nodedown,Node} -> false
+ after 30000 ->
+ io:format("Node didn't die..\n"),
+ rpc:call(Node,init,stop,[]),
+ io:format("done init:stop..\n"),
+ ok
+ end.
+
wait_for_node(_,0) ->
false;
wait_for_node(Node,N) ->
@@ -609,6 +633,18 @@ suicide_by_heart() ->
sallad
end.
+non_suicide_by_heart() ->
+ P = open_port({spawn,"heart -ht 11 -pid "++os:getpid()},[exit_status, {env, {"HEART_NO_KILL", "TRUE"}}, {packet,2}]),
+ receive X -> X end,
+ %% Just hang and wait for heart to timeout
+ receive
+ {P,{exit_status,_}} ->
+ ok
+ after
+ 20000 ->
+ exit(timeout)
+ end.
+
%% generate a module from binary
generate(Module, Attributes, FunStrings) ->
diff --git a/lib/kernel/test/inet_SUITE.erl b/lib/kernel/test/inet_SUITE.erl
index 6248d7478c..f60c13d2e3 100644
--- a/lib/kernel/test/inet_SUITE.erl
+++ b/lib/kernel/test/inet_SUITE.erl
@@ -139,11 +139,13 @@ t_gethostbyaddr(Config) when is_list(Config) ->
ok;
_ ->
io:format("alias list: ~p", [HEnt#hostent.h_aliases]),
- io:format("check alias list: ~p", [[Aliases,[Rname]]]),
+ io:format(
+ "check alias list: ~p", [[Aliases,tl(Aliases),[Rname]]]),
io:format("name: ~p", [HEnt#hostent.h_name]),
io:format("check name: ~p", [[Name,FullName]]),
- check_elems([{HEnt#hostent.h_name,[Name,FullName]},
- {HEnt#hostent.h_aliases,[[],Aliases,[Rname]]}])
+ check_elems(
+ [{HEnt#hostent.h_name,[Name,FullName]},
+ {HEnt#hostent.h_aliases,[[],Aliases,tl(Aliases),[Rname]]}])
end,
{_DName, _DFullName, DIPStr, DIP, _, _, _} = ct:get_config(test_dummy_host),
@@ -171,8 +173,9 @@ t_gethostbyaddr_v6(Config) when is_list(Config) ->
h_length = 16,
h_addr_list = [IP6]},
HEnt6_ = HEnt6,
- check_elems([{HEnt6#hostent.h_name,[Name6,FullName6]},
- {HEnt6#hostent.h_aliases,[[],Aliases6]}]),
+ check_elems(
+ [{HEnt6#hostent.h_name,[Name6,FullName6]},
+ {HEnt6#hostent.h_aliases,[[],Aliases6,tl(Aliases6)]}]),
{_DName6, _DFullName6, DIPStr6, DIP6, _} =
ct:get_config(test_dummy_ipv6_host),
@@ -195,14 +198,14 @@ t_gethostbyname(Config) when is_list(Config) ->
HEnt_ = HEnt,
check_elems([{HEnt#hostent.h_name,[Name,FullName]},
- {HEnt#hostent.h_aliases,[[],Aliases]}]),
+ {HEnt#hostent.h_aliases,[[],Aliases,tl(Aliases)]}]),
{ok,HEntF} = inet:gethostbyname(FullName),
HEntF_ = HEntF#hostent{h_name = FullName,
h_addrtype = inet,
h_length = 4,
h_addr_list = [IP]},
HEntF_ = HEntF,
- check_elems([{HEnt#hostent.h_aliases,[[],Aliases]}]),
+ check_elems([{HEnt#hostent.h_aliases,[[],Aliases,tl(Aliases)]}]),
%%
FullNameU = toupper(FullName),
{ok,HEntU} = inet:gethostbyname(FullNameU),
@@ -237,7 +240,7 @@ t_gethostbyname_v6(Config) when is_list(Config) ->
h_length = 16} = HEnt,
check_elems(
[{HEnt#hostent.h_name,[Name,FullName]},
- {HEnt#hostent.h_aliases,[[],Aliases]}]);
+ {HEnt#hostent.h_aliases,[[],Aliases,tl(Aliases)]}]);
[IP46] -> % IPv4 compatible address
{ok,HEnt4} = inet:gethostbyname(Name, inet),
#hostent{h_addrtype = inet,
@@ -257,7 +260,7 @@ t_gethostbyname_v6(Config) when is_list(Config) ->
h_addrtype = inet6,
h_length = 16} = HEntF,
check_elems(
- [{HEnt#hostent.h_aliases,[[],Aliases]}]);
+ [{HEnt#hostent.h_aliases,[[],Aliases,tl(Aliases)]}]);
[IP46F] -> % IPv4 compatible address
{ok,HEnt4F} = inet:gethostbyname(FullName, inet),
#hostent{h_addrtype = inet,
@@ -363,7 +366,7 @@ ipv4_to_ipv6(Config) when is_list(Config) ->
h_addr_list = [IP_46]},
HEnt_ = HEnt,
check_elems([{HEnt#hostent.h_name,[IP_46_Str,IPStr]},
- {HEnt#hostent.h_aliases,[[],Aliases]}]);
+ {HEnt#hostent.h_aliases,[[],Aliases,tl(Aliases)]}]);
{_,IP4to6Res} -> ok
end,
ok.
diff --git a/lib/kernel/test/inet_res_SUITE.erl b/lib/kernel/test/inet_res_SUITE.erl
index 9662d1fef5..6691ad9c06 100644
--- a/lib/kernel/test/inet_res_SUITE.erl
+++ b/lib/kernel/test/inet_res_SUITE.erl
@@ -42,6 +42,21 @@
-define(RUN_NAMED, "run-named").
+%% This test suite use a script ?RUN_NAMED that tries to start
+%% a temporary local nameserver BIND 8 or 9 that must be installed
+%% on your machine.
+%%
+%% For example, on Ubuntu 14.04, as root:
+%% apt-get install bind9
+%% Now, that is not enough since Apparmor will not allow
+%% the nameserver daemon /usr/sbin/named to read from the test directory.
+%% Assuming that you run tests in /ldisk/daily_build, and still on
+%% Ubuntu 14.04, make /usr/apparmor.d/local/usr.sbin.named contain:
+%% /ldisk/daily_build/** r,
+%% And yes; the trailing comma must be there...
+
+
+
suite() ->
[{ct_hooks,[ts_install_cth]},
{timetrap,{minutes,1}}].