aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2019-04-18 14:24:31 +0200
committerLukas Larsson <[email protected]>2019-04-18 14:24:31 +0200
commit659ed4c005bb8c943c217d52383c219c0998aafa (patch)
tree1a92dbdc38bd517027c1f3e08edfea9afdcdd423
parentd0482d868f4662ebebeb115878ea1f99da69f062 (diff)
parentbc39fa234dd2d2834985dcdd37159cbc9e4d8a51 (diff)
downloadotp-659ed4c005bb8c943c217d52383c219c0998aafa.tar.gz
otp-659ed4c005bb8c943c217d52383c219c0998aafa.tar.bz2
otp-659ed4c005bb8c943c217d52383c219c0998aafa.zip
Merge branch 'lukas/OTP-22-rc2/misc-fixes/OTP-15773'
* lukas/OTP-22-rc2/misc-fixes/OTP-15773: erts: Yield correctly when iterating over distr exit messages erts: Fix cerl -rr to use correct etp file erts: Fix etp-process-info to print exiting and free processes tools: Adjust instrument abort tc to better trigger faults erts: Fix cleanup of message factory undo erts: Make dump_SUITE:free_dump not dump via rpc erts: Add extra debugging to dist frag testcases erts: Run smaller dist frag test to 32 bit machines erl_docgen: Remove accidentally merged debug printout erts: Fix z_SUITE to always look for cerl in ERL_TOP otp: make top Makefile app target respect TYPE variable vxworks: Make vxworks configure use environment CFLAGS erts: Make erts_free debug failure easier to diagnose erts: Fix gcc warning in to_erl
-rw-r--r--Makefile.in6
-rwxr-xr-xerts/autoconf/configure.vxworks1
-rw-r--r--erts/autoconf/vxworks/sed.general2
-rw-r--r--erts/emulator/beam/erl_alloc.c15
-rw-r--r--erts/emulator/beam/erl_message.c3
-rw-r--r--erts/emulator/beam/erl_process.c10
-rw-r--r--erts/emulator/test/distribution_SUITE.erl23
-rw-r--r--erts/emulator/test/dump_SUITE.erl51
-rw-r--r--erts/etc/unix/cerl.src2
-rw-r--r--erts/etc/unix/etp-commands.in2
-rw-r--r--erts/etc/unix/to_erl.c2
-rw-r--r--erts/test/z_SUITE.erl4
-rw-r--r--lib/erl_docgen/src/docgen_edoc_xml_cb.erl1
-rw-r--r--lib/tools/test/instrument_SUITE.erl13
14 files changed, 91 insertions, 44 deletions
diff --git a/Makefile.in b/Makefile.in
index 6cbd92a55b..25003f47a9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -485,11 +485,11 @@ libs:
ifeq ($(OTP_SMALL_BUILD),true)
$(make_verbose)cd lib && \
ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \
- $(MAKE) opt
+ $(MAKE) $(TYPE)
else
$(make_verbose)cd lib && \
ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \
- $(MAKE) opt BUILD_ALL=true
+ $(MAKE) $(TYPE) BUILD_ALL=true
$(V_at)test -f $(ERL_TOP)/make/otp_built || echo "OTP built" > $(ERL_TOP)/make/otp_built
endif
@@ -498,7 +498,7 @@ APPS=$(patsubst $(ERL_TOP)/lib/%/doc,%,$(wildcard $(ERL_TOP)/lib/*/doc))
$(APPS):
$(make_verbose)cd lib/$@ && \
ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \
- $(MAKE) opt BUILD_ALL=true
+ $(MAKE) $(TYPE) BUILD_ALL=true
preloaded:
$(make_verbose)cd erts/preloaded/src && \
diff --git a/erts/autoconf/configure.vxworks b/erts/autoconf/configure.vxworks
index 1893f3f7e0..c3bdfd0095 100755
--- a/erts/autoconf/configure.vxworks
+++ b/erts/autoconf/configure.vxworks
@@ -135,6 +135,7 @@ for file in $CONFIG_FILES; do
-e "s,@HOST_TYPE@,$HOST_TYPE,g" \
-e "s,@WIND_BASE@,$WIND_BASE,g" \
-e "s,@TARGET@,$target,g" \
+ -e "s,@ENV_CFLAGS@,$CFLAGS,g" \
$in_file > $new_name
done
diff --git a/erts/autoconf/vxworks/sed.general b/erts/autoconf/vxworks/sed.general
index d32fbdc5c0..ffd5a8133c 100644
--- a/erts/autoconf/vxworks/sed.general
+++ b/erts/autoconf/vxworks/sed.general
@@ -111,7 +111,7 @@ s|@erlexec@|erl.exec|
s|@EMU_LIBOBJS@||
# General CFLAGS
-s|@GENERAL_CFLAGS@|-DHAVE_LOCALTIME_R -DHAVE_GMTIME_R -DENABLE_ELIB_MALLOC -DELIB_HEAP_USER -DELIB_SORTED_BLOCKS -DWORDS_BIGENDIAN -DELIB_DONT_INITIALIZE -DSIZEOF_CHAR=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DSIZEOF_LONG_LONG=8 -DSIZEOF_VOID_P=4 -DERTS_USE_PORT_TASKS=1|g
+s|@GENERAL_CFLAGS@|@ENV_CFLAGS@ -DHAVE_LOCALTIME_R -DHAVE_GMTIME_R -DENABLE_ELIB_MALLOC -DELIB_HEAP_USER -DELIB_SORTED_BLOCKS -DWORDS_BIGENDIAN -DELIB_DONT_INITIALIZE -DSIZEOF_CHAR=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DSIZEOF_LONG_LONG=8 -DSIZEOF_VOID_P=4 -DERTS_USE_PORT_TASKS=1|g
s|@WFLAGS@||
# Thread flags for eidefs.mk (erl_interface)
diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c
index e6169ebeaa..b9f0334172 100644
--- a/erts/emulator/beam/erl_alloc.c
+++ b/erts/emulator/beam/erl_alloc.c
@@ -3904,7 +3904,7 @@ check_memory_fence(void *ptr, Uint *size, ErtsAlcType_t n, int func)
{
Uint sz;
Uint found_type;
- UWord pre_pattern;
+ UWord pre_pattern, expected_pattern;
UWord post_pattern;
UWord *ui_ptr;
#ifdef HARD_DEBUG
@@ -3914,6 +3914,8 @@ check_memory_fence(void *ptr, Uint *size, ErtsAlcType_t n, int func)
if (!ptr)
return NULL;
+ expected_pattern = MK_PATTERN(n);
+
ui_ptr = (UWord *) ptr;
pre_pattern = *(--ui_ptr);
*size = sz = *(--ui_ptr);
@@ -3922,7 +3924,13 @@ check_memory_fence(void *ptr, Uint *size, ErtsAlcType_t n, int func)
#endif
found_type = GET_TYPE_OF_PATTERN(pre_pattern);
- if (pre_pattern != MK_PATTERN(n)) {
+
+ if (found_type != n) {
+ erts_exit(ERTS_ABORT_EXIT, "ERROR: Miss matching allocator types"
+ " used in alloc and free\n");
+ }
+
+ if (pre_pattern != expected_pattern) {
if ((FIXED_FENCE_PATTERN_MASK & pre_pattern) != FIXED_FENCE_PATTERN)
erts_exit(ERTS_ABORT_EXIT,
"ERROR: Fence at beginning of memory block (p=0x%u) "
@@ -3932,8 +3940,7 @@ check_memory_fence(void *ptr, Uint *size, ErtsAlcType_t n, int func)
sys_memcpy((void *) &post_pattern, (void *) (((char *)ptr)+sz), sizeof(UWord));
- if (post_pattern != MK_PATTERN(n)
- || pre_pattern != post_pattern) {
+ if (post_pattern != expected_pattern || pre_pattern != post_pattern) {
char fbuf[10];
char obuf[10];
char *ftype;
diff --git a/erts/emulator/beam/erl_message.c b/erts/emulator/beam/erl_message.c
index 2a0fb9e2aa..6645341512 100644
--- a/erts/emulator/beam/erl_message.c
+++ b/erts/emulator/beam/erl_message.c
@@ -1590,6 +1590,9 @@ void erts_factory_undo(ErtsHeapFactory* factory)
factory->message->hfrag.next = factory->heap_frags;
else
factory->message->data.heap_frag = factory->heap_frags;
+ /* Set the message to NIL in order for this message not to be
+ treated as a distributed message by the cleanup_messages logic */
+ factory->message->m[0] = NIL;
erts_cleanup_messages(factory->message);
break;
case FACTORY_TMP:
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 2b45d2d353..76eec96372 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -12095,6 +12095,7 @@ erts_proc_exit_handle_dist_monitor(ErtsMonitor *mon, void *vctxt, Sint reds)
Eterm watched;
Uint watcher_sz, ref_sz;
ErtsHeapFactory factory;
+ Sint reds_consumed = 0;
ASSERT(erts_monitor_is_target(mon) && mon->type == ERTS_MON_TYPE_DIST_PROC);
@@ -12139,11 +12140,13 @@ erts_proc_exit_handle_dist_monitor(ErtsMonitor *mon, void *vctxt, Sint reds)
watched,
ref,
reason);
+ reds_consumed = reds - (ctx.reds / TERM_TO_BINARY_LOOP_FACTOR);
switch (code) {
case ERTS_DSIG_SEND_CONTINUE:
case ERTS_DSIG_SEND_YIELD:
erts_set_gc_state(c_p, 0);
ctxt->dist_state = erts_dsend_export_trap_context(c_p, &ctx);
+ reds_consumed = reds; /* force yield */
break;
case ERTS_DSIG_SEND_OK:
break;
@@ -12163,7 +12166,7 @@ erts_proc_exit_handle_dist_monitor(ErtsMonitor *mon, void *vctxt, Sint reds)
erts_monitor_release(mon);
else
erts_monitor_release_both(mdp);
- return reds - (ctx.reds / TERM_TO_BINARY_LOOP_FACTOR);
+ return reds_consumed;
}
int
@@ -12350,6 +12353,7 @@ erts_proc_exit_handle_dist_link(ErtsLink *lnk, void *vctxt, Sint reds)
ErtsLink *dlnk;
ErtsLinkData *ldp = NULL;
ErtsHeapFactory factory;
+ Sint reds_consumed = 0;
ASSERT(lnk->type == ERTS_LNK_TYPE_DIST_PROC);
dlnk = erts_link_to_other(lnk, &ldp);
@@ -12386,11 +12390,13 @@ erts_proc_exit_handle_dist_link(ErtsLink *lnk, void *vctxt, Sint reds)
item,
reason,
SEQ_TRACE_TOKEN(c_p));
+ reds_consumed = reds - (ctx.reds / TERM_TO_BINARY_LOOP_FACTOR);
switch (code) {
case ERTS_DSIG_SEND_YIELD:
case ERTS_DSIG_SEND_CONTINUE:
erts_set_gc_state(c_p, 0);
ctxt->dist_state = erts_dsend_export_trap_context(c_p, &ctx);
+ reds_consumed = reds; /* force yield */
break;
case ERTS_DSIG_SEND_OK:
break;
@@ -12410,7 +12416,7 @@ erts_proc_exit_handle_dist_link(ErtsLink *lnk, void *vctxt, Sint reds)
erts_link_release_both(ldp);
else if (lnk)
erts_link_release(lnk);
- return reds - (ctx.reds / TERM_TO_BINARY_LOOP_FACTOR);
+ return reds_consumed;
}
int
diff --git a/erts/emulator/test/distribution_SUITE.erl b/erts/emulator/test/distribution_SUITE.erl
index 6e31c73e10..973a8f4717 100644
--- a/erts/emulator/test/distribution_SUITE.erl
+++ b/erts/emulator/test/distribution_SUITE.erl
@@ -75,7 +75,7 @@
optimistic_dflags_echo/0, optimistic_dflags_sender/1,
roundtrip/1, bounce/1, do_dist_auto_connect/1, inet_rpc_server/1,
dist_parallel_sender/3, dist_parallel_receiver/0,
- dist_evil_parallel_receiver/0]).
+ dist_evil_parallel_receiver/0, make_busy/2]).
%% epmd_module exports
-export([start_link/0, register_node/2, register_node/3, port_please/2, address_please/3]).
@@ -1460,11 +1460,14 @@ measure_latency_large_message(Nodename, DataFun) ->
Echo = spawn(N, fun F() -> receive {From, Msg} -> From ! Msg, F() end end),
- case erlang:system_info(build_type) of
- debug ->
+ BuildType = erlang:system_info(build_type),
+ WordSize = erlang:system_info(wordsize),
+
+ if
+ BuildType =/= opt; WordSize =:= 4 ->
%% Test 3.2 MB and 32 MB and test the latency difference of sent messages
Payloads = [{I, <<0:(I * 32 * 1024 * 8)>>} || I <- [1,10]];
- _ ->
+ true ->
%% Test 32 MB and 320 MB and test the latency difference of sent messages
Payloads = [{I, <<0:(I * 32 * 1024 * 1024 * 8)>>} || I <- [1,10]]
end,
@@ -1479,7 +1482,7 @@ measure_latency_large_message(Nodename, DataFun) ->
stop_node(N),
case {lists:max(Times), lists:min(Times)} of
- {Max, Min} when Max * 0.25 > Min ->
+ {Max, Min} when Max * 0.25 > Min, BuildType =:= opt ->
ct:fail({incorrect_latency, IndexTimes});
_ ->
ok
@@ -1504,13 +1507,19 @@ measure_latency(DataFun, Dropper, Echo, Payload) ->
ok
end || _ <- lists:seq(1,10)],
- {TS, _} =
+ {TS, Times} =
timer:tc(fun() ->
[begin
+ T0 = erlang:monotonic_time(),
Echo ! {self(), hello},
- receive hello -> ok end
+ receive hello -> ok end,
+ (erlang:monotonic_time() - T0) / 1000000
end || _ <- lists:seq(1,100)]
end),
+ Avg = lists:sum(Times) / length(Times),
+ StdDev = math:sqrt(lists:sum([math:pow(V - Avg,2) || V <- Times]) / length(Times)),
+ ct:pal("Times: Avg: ~p Max: ~p Min: ~p Var: ~p",
+ [Avg, lists:max(Times), lists:min(Times), StdDev]),
[begin
Sender ! die,
receive
diff --git a/erts/emulator/test/dump_SUITE.erl b/erts/emulator/test/dump_SUITE.erl
index 3b860ebdf6..9f8ac42fa9 100644
--- a/erts/emulator/test/dump_SUITE.erl
+++ b/erts/emulator/test/dump_SUITE.erl
@@ -137,26 +137,43 @@ exiting_dump(Config) when is_list(Config) ->
free_dump(Config) when is_list(Config) ->
Dump = filename:join(proplists:get_value(priv_dir, Config),"signal_abort.dump"),
- {ok, Node} = start_node(Config),
-
- Self = self(),
-
- Pid = spawn_link(Node,
- fun() ->
- Self ! ready,
- receive
- ok ->
- unlink(Self),
- exit(lists:duplicate(1000,1000))
- end
- end),
+ {ok, NodeA} = start_node(Config),
+ {ok, NodeB} = start_node(Config),
- true = rpc:call(Node, os, putenv, ["ERL_CRASH_DUMP",Dump]),
- [erlang:monitor(process, Pid) || _ <- lists:seq(1,10000)],
- receive ready -> unlink(Pid), Pid ! ok end,
+ Self = self(),
- rpc:call(Node, erlang, halt, ["dump"]),
+ PidA = spawn_link(
+ NodeA,
+ fun() ->
+ Self ! ready,
+ receive
+ ok ->
+ spawn(fun() ->
+ erlang:system_monitor(self(), [busy_dist_port]),
+ timer:sleep(5),
+ receive
+ M ->
+ io:format("~p",[M]),
+ erlang:halt("dump")
+ end
+ end),
+ exit(lists:duplicate(1000000,100))
+ end
+ end),
+
+ spawn_link(NodeB,
+ fun() ->
+ [erlang:monitor(process, PidA) || _ <- lists:seq(1,10000)],
+ Self ! done,
+ receive _ -> ok end
+ end),
+
+ receive done -> ok end,
+ true = rpc:call(NodeA, os, putenv, ["ERL_CRASH_DUMP",Dump]),
+ ct:pal("~p",[rpc:call(NodeA, distribution_SUITE, make_busy, [NodeB, 1000])]),
+
+ receive ready -> unlink(PidA), PidA ! ok end,
{ok, Bin} = get_dump_when_done(Dump),
diff --git a/erts/etc/unix/cerl.src b/erts/etc/unix/cerl.src
index bcd64d242e..8cfc2d549e 100644
--- a/erts/etc/unix/cerl.src
+++ b/erts/etc/unix/cerl.src
@@ -320,7 +320,7 @@ if [ "x$GDB" = "x" ]; then
if [ "$1" = "-p" ]; then
echo 'set $etp_rr_run_until_beam = 1' >> $cmdfile
fi
- cat $ROOTDIR/erts/etc/unix/etp-commands.in >> $cmdfile
+ cat $ROOTDIR/erts/etc/unix/etp-commands >> $cmdfile
exec rr replay -x $cmdfile $*
elif [ $1 = ps ]; then
shift
diff --git a/erts/etc/unix/etp-commands.in b/erts/etc/unix/etp-commands.in
index dc28107ef5..36786aa302 100644
--- a/erts/etc/unix/etp-commands.in
+++ b/erts/etc/unix/etp-commands.in
@@ -2090,7 +2090,7 @@ define etp-process-info-int
etp-pid2proc-1 $etp_proc->common.id
etp-process-info $proc
else
- if (*(((Uint32 *) &($etp_proc->state))) & 0x4) == 0
+ if (*(((Uint32 *) &($etp_proc->state))) & 0x800) == 0
if ($etp_proc->common.u.alive.reg)
printf " Registered name: "
etp-1 $etp_proc->common.u.alive.reg->name
diff --git a/erts/etc/unix/to_erl.c b/erts/etc/unix/to_erl.c
index ed4fe12e8b..1448980f77 100644
--- a/erts/etc/unix/to_erl.c
+++ b/erts/etc/unix/to_erl.c
@@ -415,7 +415,7 @@ int main(int argc, char **argv)
if (len) {
#ifdef DEBUG
- (void)write(1, buf, len);
+ write_all(1, buf, len);
#endif
if (write_all(wfd, buf, len) != len) {
fprintf(stderr, "Error in writing to FIFO.\n");
diff --git a/erts/test/z_SUITE.erl b/erts/test/z_SUITE.erl
index 6a34299dd2..536212af2e 100644
--- a/erts/test/z_SUITE.erl
+++ b/erts/test/z_SUITE.erl
@@ -88,10 +88,10 @@ find_cerl(DBTop) ->
[Cerl | _ ] ->
case filelib:is_regular(Cerl) of
true -> Cerl;
- _ -> false
+ _ -> find_cerl(false)
end;
_ ->
- false
+ find_cerl(false)
end.
is_dir(false) ->
diff --git a/lib/erl_docgen/src/docgen_edoc_xml_cb.erl b/lib/erl_docgen/src/docgen_edoc_xml_cb.erl
index 2c9aa2e3a3..5342d02947 100644
--- a/lib/erl_docgen/src/docgen_edoc_xml_cb.erl
+++ b/lib/erl_docgen/src/docgen_edoc_xml_cb.erl
@@ -1260,7 +1260,6 @@ get_text(#xmlElement{content=[E]}) ->
%% text_and_name_only(Es) -> {N, Ts}
text_and_a_name_only(Es) ->
- erlang:display(Es),
case [Name || #xmlElement{
name = a,
attributes = [#xmlAttribute{name=name}]}=Name <- Es] of
diff --git a/lib/tools/test/instrument_SUITE.erl b/lib/tools/test/instrument_SUITE.erl
index 33259df58f..f474669836 100644
--- a/lib/tools/test/instrument_SUITE.erl
+++ b/lib/tools/test/instrument_SUITE.erl
@@ -260,13 +260,18 @@ test_format(Options0, Gather, Verify) ->
test_abort(Gather) ->
%% There's no way for us to tell whether this actually aborted or ran to
%% completion, but it might catch a few segfaults.
+ %% This testcase is mostly useful when run in an debug emulator as it needs
+ %% the modified reduction count to trigger the odd trap scenarios
Runner = self(),
Ref = make_ref(),
spawn_opt(fun() ->
- [Gather({Type, SchedId, 1, 1, Ref}) ||
- Type <- erlang:system_info(alloc_util_allocators),
- SchedId <- lists:seq(0, erlang:system_info(schedulers))],
- Runner ! Ref
+ [begin
+ Ref2 = make_ref(),
+ [Gather({Type, SchedId, 1, 1, Ref2}) ||
+ Type <- erlang:system_info(alloc_util_allocators),
+ SchedId <- lists:seq(0, erlang:system_info(schedulers))]
+ end || _ <- lists:seq(1,100)],
+ Runner ! Ref
end, [{priority, max}]),
receive
Ref -> ok