I wrote a rule to run some compiler (Synopsys VCS MX). When running a single target, everything works great. When running multiple targets concurrently, the compiler runs into a segmentation fault. This doesn't happen when running Bazel with --spawn_strategy=local
. Also setting --jobs 1
works.
The only reason for this that I can think of, is that the compiler tries to write to a file with an absolute path, colliding with other instances of itself.
My questions are as follows:
- If my theory was correct, wouldn't the problem occur regardless of weather I'm sandboxing or not?
- If I'm wrong, how could the compilers be colliding if not because of some shared file?
- Say that for every sandbox, I wanted to mount a
/tmp
which points to a different directory, would that be possible?
Update:
According to what I saw in strace
, both instances of the compiler open a file /tmp/vcs_20200428163636_3/v710_tok
for reading and writing, and at some point one instance calls pread64()
which causes the segfault. Notice the files name, which looks suspiciously like the date hinting there was an attempt get a unique file name, but both instances weren't executed far enough apart.
Question 1 and 3 still stand.