Skip to content

Concuerror assumes instant delivery of {'DOWN', _Mref, ..., noproc} message #354

@ieQu1

Description

@ieQu1

Describe the bug
It looks like Concuerror assumes that DOWN messages are delivered instantaneously.
Consider the following testcase:

monitor_test() ->
  %% Preparation:
  %%   Create a process:
  Pid = spawn(fun() -> ok end),
  %%   Make sure it's dead:
  MRef1 = monitor(process, Pid),
  receive {'DOWN', MRef1, _, _, _} -> ok end,
  %% Actual test:
  MRef2 = monitor(process, Pid),
  ?assertMatch(received,
               receive
                 {'DOWN', MRef2, _, _, noproc} ->
                   received
               after 0 ->
                   not_received
               end).

This assertion shouldn't hold, because BEAM doesn't guarantee that the second DOWN message will arrive immediately.

To Reproduce
I'm using fairly standard CLI options:

CONCUERROR := $(BUILD_DIR)/Concuerror/bin/concuerror
CONCUERROR_RUN := $(CONCUERROR) \
	-x code -x code_server -x error_handler \
	-pa $(BUILD_DIR)/concuerror+test/lib/optvar/ebin

# Run test:
.PHONY: concuerror_test
concuerror_test: $(CONCUERROR)
	rebar3 as concuerror eunit -m concuerror_tests || true # Actual eunit test fails
	$(call concuerror,monitor_test)

# Recipe to build concuerror
$(CONCUERROR):
	mkdir -p _build/
	cd _build && git clone https://github.com/parapluu/Concuerror.git
	$(MAKE) -C _build/Concuerror/

Erlang version:

Erlang/OTP 25 [erts-13.2.2] [emqx-8639768b7a] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Also reproduces on the upstream OTP26 version.

Expected behavior
Concuerror explores both branches of the receive.
Assertion fails with value not_delivered.

Environment (please complete the following information):

  • OS: Linux 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
  • Concuerror Version: Concuerror 0.21.0+build.2371.refaf91d78

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions