After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688132 - code generation during build has a race due to unintended concurrency
code generation during build has a race due to unintended concurrency
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: General
unspecified
Other All
: Normal normal
: ---
Assigned To: empathy-maint
empathy-maint
Depends on:
Blocks:
 
 
Reported: 2012-11-12 01:46 UTC by Allison Karlitskaya (desrt)
Modified: 2013-01-02 09:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make parallel builds work (906 bytes, patch)
2012-11-30 18:31 UTC, Debarshi Ray
none Details | Review
Make parallel builds work (1.55 KB, patch)
2012-11-30 18:48 UTC, Debarshi Ray
committed Details | Review
extensions: fix parallel build (1009 bytes, patch)
2012-12-28 13:31 UTC, Guillaume Desmottes
committed Details | Review

Description Allison Karlitskaya (desrt) 2012-11-12 01:46:29 UTC
make[2]: Entering directory `/home/desrt/jhbuild/checkout/empathy/extensions'
  GEN    _gen/all.xml
  GEN    _gen/misc.xml
  GEN    _gen/cli-misc.h
  GEN    _gen/svc-misc.h
  GEN    _gen/cli-misc-body.h
  GEN    _gen/svc-misc.c
  GEN    _gen/register-dbus-glib-marshallers-body.h
  GEN    _gen/enums.h
  GEN    _gen/gtypes.h
  GEN    _gen/gtypes-body.h
  GEN    _gen/interfaces.h
  GEN    _gen/interfaces-body.h
  GEN    extensions.html
make[2]: Leaving directory `/home/desrt/jhbuild/checkout/empathy/extensions'
make[1]: Leaving directory `/home/desrt/jhbuild/checkout/empathy'
Traceback (most recent call last):
  • File "../tools/glib-ginterface-gen.py", line 838 in <module>
    end_headers, not_implemented_func, allow_havoc)()
  • File "../tools/glib-ginterface-gen.py", line 764 in __call__
    file_set_contents(self.basename + '.h', '\n'.join(self.__header))
  • File "/home/desrt/jhbuild/checkout/empathy/tools/libtpcodegen.py", line 42 in file_set_contents
    os.rename(filename + '.tmp', filename)
OSError: [Errno 2] No such file or directory
make[2]: *** [_gen/svc-misc.h] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


Reading the Makefile.am:

_gen/svc-misc.c _gen/svc-misc.h: _gen/misc.xml \
        $(tools_dir)/glib-ginterface-gen.py
        $(AM_V_GEN)$(PYTHON) $(tools_dir)/glib-ginterface-gen.py \
                --filename=_gen/svc-misc \
                --signal-marshal-prefix=_emp_ext \
                --include='<telepathy-glib/telepathy-glib.h>' \
                --not-implemented-func='tp_dbus_g_method_return_not_implemented' \
                --allow-unstable \
                $< Emp_Svc_

and

nodist_libemp_extensions_la_SOURCES = \
    _gen/register-dbus-glib-marshallers-body.h \
    _gen/enums.h \
    _gen/gtypes.h \
    _gen/gtypes-body.h \
    _gen/interfaces.h \
    _gen/interfaces-body.h \
    _gen/cli-misc.h \
    _gen/cli-misc-body.h \
    _gen/svc-misc.h \
    _gen/svc-misc.c


It's pretty clear that svc-misc.h and svc-misc.c are both attempting to be generated, separately, using the same rule (ie: the same thing is being done twice).

In parallel builds, one instance of this has a chance of stepping on the other, renaming the .tmp file out from under it.  This leads to the error above.

The fix is probably something along the lines of changing one of the files (.h?) to be a straight dependency on the other file (.c?) so that the codegen only runs once.
Comment 1 Allison Karlitskaya (desrt) 2012-11-25 05:22:59 UTC
I've hit this race a total of three times now... it's not really all that thin, it seems... at least on my machine.
Comment 2 Debarshi Ray 2012-11-30 18:31:24 UTC
Created attachment 230324 [details] [review]
Make parallel builds work
Comment 3 Debarshi Ray 2012-11-30 18:48:11 UTC
Created attachment 230328 [details] [review]
Make parallel builds work

Add some comments and explanation for good measure.
Comment 4 Debarshi Ray 2012-11-30 18:54:46 UTC
From #empathy on irc.gnome.org:
<desrt> rishi: i bet that fixes it, indeed
<sjoerd> rishi: looks great, go for it ;)
Comment 5 Allison Karlitskaya (desrt) 2012-12-08 12:48:47 UTC
Same bug with at least one more file...

make[2]: *** [_gen/cli-misc.h] Error 1
Comment 6 Guillaume Desmottes 2012-12-28 13:31:01 UTC
Created attachment 232328 [details] [review]
extensions: fix parallel build

Based on a similar fix from Debarshi Ray:
f1ab42c0c5332e47b33ecf905afd7fd6c2a344e8
Comment 7 Debarshi Ray 2012-12-29 06:08:22 UTC
Comment on attachment 232328 [details] [review]
extensions: fix parallel build

I don't have a system to test it, but looks fine to me. Maybe add a comment as sjoerd wanted last time.
Comment 8 Guillaume Desmottes 2013-01-02 09:37:27 UTC
Attachment 232328 [details] pushed as aadf937 - extensions: fix parallel build