Re: Suggestion to induce a random delay before compiling.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/19/10 05:49 PM, Andrew Haley wrote:
On 19/09/10 14:01, Dr. David Kirkby wrote:
We have noted on the Sage maths project that we get occasional build
failures when the constituent parts are built in parallel. Each time a
bug is found, the Makefile gets edited, only for another to be found. I
built one component called "Singular" 110 times and it worked in all 110
times. I did this in 4 directories and started the builds at different
times, but still I got the problem.

Others had built this package in parallel too. Then a Linux user
suddenly gets a a build failure due to a race condition.

This got me thinking if there was a way to make such race conditions
more easily found. One idea I had was for gcc to have an option to sleep
for a random time before it actually did anything. So if file A takes
longer to compiler than file B, by introducing some random element, this
would change. This should make uncovering race conditions much easier.

Does that sound a sensible idea?

Sure, but it's a trivial wrapper script.

Andrew.

I always find wrapper scripts annoying though. For one reason or another, they have often presented problems. I've seen others have problems with wrapper scripts too. I know for a fact there's a wrapper script for Fortran built into this code.

Can you give me your idea of what is the perfect wrapper script for gcc/g++/gfortran? Creating a program to sleep for short delays would be quite easy - just read from /dev/random and use nanosleep. The use of a pseduo random number generator might be possible - though how to seed them, and save the state needs a bit of care. But I've seen too often where a wrapper script fails under one set of circumstances or another.


As a matter of interest, if I wanted to add such a delay into gcc myself, what file would be best to do this in? I actually think reading an environment variable might be better than a command line switch, as often code sets switches and its more difficult to fiddle them. In contrast, if I could get gcc to check for a couple of environment variables, such as

GCC_MIN_SLEEP
GCC_MAX_SLEEP

and set to some number of microseconds, it would help I think. I just don't know where would be the best place to put such code. I'm sure if I search the source code for "main" I'll find lots of mains, and will now know what one is the best place.

I need this to work for gcc, gfortran and g++, so guess doing this in the compiler, rather than the very front end, would be the best place.

Dave


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux