Mercury Bugs - mercury
View Issue Details
0000273mercuryBugpublic2013-01-06 10:422013-11-19 12:50
Reporterony 
Assigned Topbone 
PrioritylowSeverityminorReproducibilitysometimes
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000273: race condition in Mmakefiles of deep_profiler and slice
DescriptionDuring build with -j9 from master branch I wasn't able to succeed few times because of permission deny for copying in $(MDBCOMP_MODULES).
Steps To ReproduceAt master branch bootstrap from existing compiler and use multiple jobs
make PARALLEL=-j9
Additional InformationLooks like the reason for that is race condition from rule that fired twice in parallel for same files and thus had scenario:
1. [thread1] chmod a+w feedback.m
2. [thread1] cp ../mdbcomp/feedback.m .
3. [thread2] chmod a+w feedback.m
4. [thread1] chmod a-w feedback.m
5. [thread2] cp ../mdbcomp/feedback.m . # fails on permission deny

Refactoring process of pulling in modules from $(MDBCOMP_DIR) should solve this issue.
TagsNo tags attached.
Attached Filespatch mercury-scm-fix-bug273-race-cond.-in-slice-and-deep_profile.patch (7,000) 2013-01-06 13:10
https://bugs.mercurylang.org/file_download.php?file_id=170&type=bug

Notes
(0000491)
juliensf   
2013-01-07 11:43   
Copying the files instead of referring to the mdbcomp directory is (clearly) deliberate. The reason
for doing so to avoid stack overflows in some of the profiling / slice tools when the entire Mercury system
is built with tracing enabled. (The proposed patch would break this and make testing the Mercury
compiler in some configurations impossible.)

The race condition can be avoided by building the dependencies *before* doing the main build, e.g.
do

    $ mmake depend
    $ mmake -j9
(0000582)
pbone   
2013-11-19 12:49   
I fixed this back in January and forgot to close the bug then.

Issue History
2013-01-06 10:42onyNew Issue
2013-01-06 13:10onyFile Added: mercury-scm-fix-bug273-race-cond.-in-slice-and-deep_profile.patch
2013-01-07 11:43juliensfNote Added: 0000491
2013-11-19 12:49pboneNote Added: 0000582
2013-11-19 12:50pboneStatusnew => closed
2013-11-19 12:50pboneAssigned To => pbone
2013-11-19 12:50pboneResolutionopen => fixed