Thread: [Ipsec-tools-devel] [PATCH] parallel build race
Brought to you by:
mit_warlord,
netbsd
From: Natanael C. <nat...@gm...> - 2007-11-26 18:41:05
Attachments:
ipsec-tools-yacc-race.patch
|
Hi, the following Make rules in src/racoon/Makefile.am causes a race condition when building with parallel builds (-j option to GNU make): # Config file parser cftoken.o: cftoken.c cfparse.h $(COMPILE) -c -o $@ $< cfparse.o: cfparse.c $(COMPILE) -c -o $@ $< ... When GNU make tries to build the cfparse.h and cftarse.c mentioned in the rules above, it will run the rule below twice, at the same time. Since both creates y.tab.c and y.tab.h and rename those at the same time, a race condition happens and the parallel build dies. cfparse.h cfparse.c: $(srcdir)/cfparse.y $(YACC) -d $(srcdir)/cfparse.y && \ mv y.tab.c cfparse.c && \ mv y.tab.h cfparse.h Same happens with the Plain RSA parser: # Plain-RSA parser prsa_tok.o: prsa_tok.c prsa_par.h $(COMPILE) -c -o $@ $< prsa_par.o: prsa_par.c $(COMPILE) -c -o $@ $< ... prsa_par.h prsa_par.c: $(srcdir)/prsa_par.y $(YACC) -pprsa -d $(srcdir)/prsa_par.y && \ mv y.tab.c prsa_par.c && \ mv y.tab.h prsa_par.h And what is more funny trying to build cfparse.[ch] and prsa_par.[ch] will both create a temp y.tab.[ch] at the same time. another race. Attatched patch will fix the problem by: * define the .c file as a dependency for .h since it creates both. * prefix the tab.[ch] files with th e yacc -b option so we dont have 4 process trying to create y.tab.c and y.tab.h temp files at the same time. After that it should be safe to perform parallel builds. Thanks! -nc |
From: Natanael C. <nat...@gm...> - 2007-11-26 17:18:55
Attachments:
ipsec-tools-yacc-race.patch
|
Hi, the following Make rules in src/racoon/Makefile.am causes a race condition when building with parallel builds (-j option to GNU make): # Config file parser cftoken.o: cftoken.c cfparse.h $(COMPILE) -c -o $@ $< cfparse.o: cfparse.c $(COMPILE) -c -o $@ $< ... When GNU make tries to build the cfparse.h and cftarse.c mentioned in the rules above, it will run the rule below twice, at the same time. Since both creates y.tab.c and y.tab.h and rename those at the same time, a race condition happens and the parallel build dies. cfparse.h cfparse.c: $(srcdir)/cfparse.y $(YACC) -d $(srcdir)/cfparse.y && \ mv y.tab.c cfparse.c && \ mv y.tab.h cfparse.h Same happens with the Plain RSA parser: # Plain-RSA parser prsa_tok.o: prsa_tok.c prsa_par.h $(COMPILE) -c -o $@ $< prsa_par.o: prsa_par.c $(COMPILE) -c -o $@ $< ... prsa_par.h prsa_par.c: $(srcdir)/prsa_par.y $(YACC) -pprsa -d $(srcdir)/prsa_par.y && \ mv y.tab.c prsa_par.c && \ mv y.tab.h prsa_par.h And what is more funny trying to build cfparse.[ch] and prsa_par.[ch] will both create a temp y.tab.[ch] at the same time. another race. Attatched patch will fix the problem by: * define the .c file as a dependency for .h since it creates both. * prefix the tab.[ch] files with th e yacc -b option so we dont have 4 process trying to create y.tab.c and y.tab.h temp files at the same time. After that it should be safe to perform parallel builds. Thanks! -nc |
From: VANHULLEBUS Y. <va...@fr...> - 2007-11-29 16:24:59
|
On Mon, Nov 26, 2007 at 07:41:02PM +0100, Natanael Copa wrote: > Hi, Hi. [....] > Attatched patch will fix the problem by: > * define the .c file as a dependency for .h since it creates both. > * prefix the tab.[ch] files with th e yacc -b option so we dont have 4 > process trying to create y.tab.c and y.tab.h temp files at the same > time. Commited in HEAD and 0.7 branch, thanks for the patch. And as Matthew said, we have more known problems with autotools, feel free to have a look at them as you seems to have some knowledge with those tools ! :-) Yvan. |
From: Chris R. <Chr...@nr...> - 2007-11-26 19:10:41
|
Anyone know if there is a like function within libipsec similar to setkey.c's parse_string function? It would make life easier than having to mess with sadb_msg parameters. Thanks....chris |