Mercury Bugs - mercury
View Issue Details
0000461mercuryBugpublic2018-05-17 11:152020-04-20 15:06
Reporterwangp 
Assigned Towangp 
PrioritynormalSeverityminorReproducibilitysometimes
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000461: MR_verify_final_engine_sleep_sync assertion failure (parallel conjunction)
DescriptionTests in par_conj fail intermittently in asm_fast.par.gc with an assertion failure of the form:

dep_par_17: mercury_context.c:1839: MR_verify_final_engine_sleep_sync: Assertion `esync->d.es_action == MR_ENGINE_ACTION_NONE' failed.


(As I remember, it doesn't just affect parallel conjunction but threads as well.)
TagsNo tags attached.
Attached Files

Notes
(0001081)
wangp   
2020-04-17 13:40   
I found that I can reproduce this without parallel conjunction. The following command fails reliably on my machine. (parallel is GNU parallel; closeable_channel_test is from tests/hard_coded)

parallel ./closeable_channel_test >/dev/null ::: `seq 1 1000`

When the assertion in MR_verify_final_engine_sleep_sync fails, the value of esync->d.es_action is always MR_ENGINE_ACTION_SHUTDOWN.
(0001082)
wangp   
2020-04-17 17:34   
In MR_do_idle_worksteal we have:

        switch (esync->d.es_action) {
            case MR_ENGINE_ACTION_SHUTDOWN:
                action_shutdown_ws_engine();

Then the call sequence goes:

action_shutdown_ws_engine -> MR_finalize_thread_engine -> MR_shutdown_engine_for_threads -> MR_verify_final_engine_sleep_sync

Nothing changes esync->d.es_action before MR_verify_final_engine_sleep_sync asserts its value:

    assert(esync->d.es_action == MR_ENGINE_ACTION_NONE);


So the fix is either to widen the assertion, or to set esync->d.es_action = MR_ENGINE_ACTION_NONE somewhere after switching on it.
(0001083)
wangp   
2020-04-20 15:06   
Fix committed 2020-04-20

Issue History
2018-05-17 11:15wangpNew Issue
2020-04-17 13:40wangpNote Added: 0001081
2020-04-17 17:34wangpNote Added: 0001082
2020-04-20 15:06wangpAssigned To => wangp
2020-04-20 15:06wangpStatusnew => resolved
2020-04-20 15:06wangpResolutionopen => fixed
2020-04-20 15:06wangpNote Added: 0001083