Issue 61969 - dmake prematurely ends target (re-)building
Summary: dmake prematurely ends target (re-)building
Status: CLOSED FIXED
Alias: None
Product: Build Tools
Classification: Code
Component: solenv (show other issues)
Version: current
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: hjs
QA Contact: issues@tools
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-12 21:24 UTC by quetschke
Modified: 2013-08-07 15:34 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Patch for solenv to show the problem (1.96 KB, patch)
2006-02-12 21:32 UTC, quetschke
no flags Details | Diff
Logfile generated with previous patch applied. (18.38 KB, patch)
2006-02-12 21:33 UTC, quetschke
no flags Details | Diff
Patch for dmake that shows orphaned child processes (1.33 KB, patch)
2006-02-13 16:19 UTC, quetschke
no flags Details | Diff
Patch for dmake (962 bytes, patch)
2006-02-15 05:19 UTC, quetschke
no flags Details | Diff
Updated patch for dmake/rulparse.c (945 bytes, patch)
2006-03-02 03:42 UTC, quetschke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description quetschke 2006-02-12 21:24:47 UTC
I get the following error with a parallel dmake build of sysui:
(W32-tcsh/dmake from m156)

$ build -- -vr -P3

(snip)
Checking:../wntmsci10.pro/
Error: ../wntmsci10.pro/misc/soquickstart.dprc 0 Bytes!
Error: 1 damaged files encountered
dmake:  Error code 1, while making '../wntmsci10.pro/misc/checksize.done'
echo '---* tg_merge.mk *---'

If I use -P1 the file is not zero and everything works.
Comment 1 quetschke 2006-02-12 21:31:45 UTC
The following patch for solenv makes the problem more visible.

The logfile after the patch is generated with the patch applied and this command:
$ build -- -vr -P3 > sysui_multi.log 2>&1
Comment 2 quetschke 2006-02-12 21:32:56 UTC
Created attachment 34099 [details]
Patch for solenv to show the problem
Comment 3 quetschke 2006-02-12 21:33:56 UTC
Created attachment 34100 [details]
Logfile generated with previous patch applied.
Comment 4 quetschke 2006-02-12 21:43:54 UTC
In rules.mk there should be "date;echo done" started after generating the *.dprc,
but as you can see in the logfile the output never reaches the logfile. The
target seems never to finish.

If you force the APPxTARGET to need a little longer by increasing the number of
seconds in
	echo "in APP1TARGET - waiting a little";sleep 1
the module finishes successfull.

@ause: This might well be a dmake problem but you are the master of the *.dp*
magic files, can you have a look. It also looks strange that soquickstart.dprc
is generated twice and unfortunately dmake finishes its ?main?-target right
after the second
  /bin/rm -f ../../../../wntmsci10.pro/misc/soquickstart.dprc.
Comment 5 quetschke 2006-02-13 16:19:40 UTC
Created attachment 34119 [details]
Patch for dmake that shows orphaned child processes
Comment 6 quetschke 2006-02-14 00:08:43 UTC
This issue looks like issue 54938, but the testcase (misc-5) from that issue
still passes.
Comment 7 quetschke 2006-02-15 03:44:11 UTC
I got a short testcase:

- - - include.mk - - -
SHELL*:=/bin/sh 
SHELLFLAGS*:=-ce

TARGET=mytarget

%.dpcc : %.cpp
	@echo making: $@
	@sleep 2
	@echo still making: $@
	@+echo $@ : $(@:b).obj > $@

%.obj : %.cpp
	@echo making: $@
	@+sleep 1 # need to change .obj timestamp
	@+cat $< > $@

%.exe : %.obj
	@echo making: $@
	@+cat $< > $@

.INCLUDE : $(TARGET).dpcc

ALL : $(TARGET).dpcc $(TARGET).exe
- - - include.mk - - -

When you start it like this you get the following output:

$ rm -f mytarget.{dpcc,obj,exe} ; dmake/dmake.exe -r -P2 -f include.mk ALL
making: mytarget.dpcc
still making: mytarget.dpcc
making: mytarget.obj
making: mytarget.dpcc
making: mytarget.exe
dmake:  Warning: -- Found running target [mytarget.dpcc], finishing ...

still making: mytarget.dpcc

This output was from dmake43p01 with the lost_child.diff patch. Without that
patch the "still making ..." part would just be missing.
Comment 8 quetschke 2006-02-15 04:04:46 UTC
Even shorter:

- - - include_2.mk - - -
SHELL*:=/bin/sh 
SHELLFLAGS*:=-ce

TARGET=mytarget

%.dpcc : %.cpp
	@echo making: $@
	@sleep 2
	@echo still making: $@
	@+echo $@ : $(@:b).obj > $@

%.obj : %.cpp
	@echo making: $@
	@+sleep 1 # need to change .obj timestamp
	@+cat $< > $@

.INCLUDE : $(TARGET).dpcc

$(TARGET).dpcc :
- - - include_2.mk - - -

$ rm -f mytarget.{dpcc,obj} ; dmake/dmake.exe -r -P2 -f include_2.mk
making: mytarget.dpcc
still making: mytarget.dpcc
dmake:  Warning: -- Found running target [mytarget.obj], finishing ...

making: mytarget.obj

It looks like mytarget.dpcc doesn't get fully build because was already build
as a prerequisite for the .INCLUDE.
Comment 9 quetschke 2006-02-15 05:19:35 UTC
Created attachment 34170 [details]
Patch for dmake
Comment 10 quetschke 2006-02-15 05:24:34 UTC
The previous patch forces dmake not to think that a target is already build if
the prerequisits or recipe lines change. This can be the case for infered
.INCLUDE files.

(Issue added to CWS dmake43p01)
Comment 11 quetschke 2006-02-16 01:43:17 UTC
See issue 62118 for another (better?) place to fix the F_MADE/F_STAT flags.
F_VISITED has to be handled from that issue anyway.
Comment 12 quetschke 2006-03-02 03:33:29 UTC
I changed the summary to reflect the actual problem. The following makefile
illustrates it:

--- inc_target.mk ---
SHELL*:=/bin/sh 
SHELLFLAGS*:=-ce

%.dpcc :
# The following line adds a dependency to %.obj when the %.dpcc is included
	@+echo $@ : $(@:b).obj > $@

# This has to be build if mytarget.dpcc is included and is requested
# as a target
# Adding the wait makes sure that the unpatched dmake is ended before the
# next recipe line is started, therefore loosing it.
%.obj :
	@sleep 1
	@echo making: $@

.INCLUDE : mytarget.dpcc

# Make this the main target
mytarget.dpcc :

--- inc_target.mk ---
$ dmake -r -P2 -f inc_target.mk

If a dependency is added to a target after it is already build as an
indered .INCLUDE makefile the new dependency can be lost in parallel
builds. In this example
  making: mytarget.obj
is only issued if no parallel builds, i.e. -P1 is used.

Note, this is not an artificial example, the dependency generation stuff uses
constructs like this.

@cmc: Might be relevant for your parallel builds too.
Comment 13 quetschke 2006-03-02 03:42:19 UTC
Created attachment 34539 [details]
Updated patch for dmake/rulparse.c
Comment 14 quetschke 2006-03-02 03:55:01 UTC
I committed the patch and a testcase to dmake43p01.

@ause: Please verify.
Comment 15 hjs 2006-04-19 15:28:45 UTC
.
Comment 16 hjs 2006-04-21 17:27:00 UTC
.