Background:
Recently I used distcc
to do distributed compilation, and found that some large files often could not be sent back to the local computer after compilation.
I checked the logs and code, and the reason for this is that Broken pipe
appears when the server calls sendfile.
Problem
The problem can be summarized as:
- client send a large input file (400M) to server
- server receive input file and start to compile, which takes 300s
- client call
select()
to wait server send output - server compile end and try send output. when call
sendfile()
will get errorBroken pipe
Some of the triggering conditions are:
- It can only be reproduced on a certain number of specific machines, but it is the same as the normal machine system version (Linux version 4.18.0-2.4.3), and I don’t know if there is any difference in system configuration.
- Trigger 10 compilations at the same time, only 1-2 compilations fail.
Could it be caused by the buffer size? Because it only occurs when there are large files + simultaneous triggers