Open 64 opened 7 months ago
Looking into this a bit further. I'm using strace -f -yY -o log.txt make -j2
to see what's going on. Grepping for the jobserver fifo ("GMfifo")
shows all operations on it: (note the 'finished' parts of some syscalls are not shown due to strace interleaving output)
```
13767
```
15030
It seems like the tokens are being correctly returned to the jobserver in both cases, but make
never sees the read()
call return 0 because one of the sccache processes kept the file open (count 3 open calls vs 2 close calls). lsof /tmp/GMfifo15030
confirms this.
It seems to be caused by the relatively new feature of GNU Make (>4.3.90
) where the jobserver communication is done by a named FIFO (--jobserver-auth=fifo:/tmp/GMfifoXXXX
)(commit, docs) rather than opening a pipe (--jobserver-auth=R,W
).
Indeed, passing make --jobserver-style=pipe
causes the reproducer in OP to exit successfully, whereas --jobserver-style=fifo
hangs. Cargo seems to manage its jobserver via pipes, so issue only appears when make launches sccache, or indirectly launches it via cargo, and forces everything to used a named fifo.
It's not obvious what the right fix is though. Spawning the server daemon with the context of a jobserver sounds inherently broken to me. Instead, shouldn't the server act as if it was spawned from nothing, and clients pass their jobserver info for each compile request they make to the server?
Minimal reproducer: (sccache v0.7.7, GNU make v4.4.1, cargo v1.78.0-nightly
194a60b29
)WORKAROUND: Simply
sccache --start-server
before invokingmake
. Alternatively, you can invokemake
with--jobserver-style=pipe
.