-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the bug
While running nix build inside a gvisor container, I intermittently see the following error:
error:
… while waiting for the build environment for '/nix/store/58w946lldvwmy4isl79lz1vnl5qh23ls-sandbox-env.drv' to initialize (succeeded, previous messages: )
error: reading a line: Input/output error
From gvisor's strace I see that the cause of this error is a read from /dev/pts/ptmx that returns EIO. EIO is an expected error that occurs when the slave closes the file descriptor.
However, the code here:
| return readLine(builderOut.get()); |
just uses the readLine function that does not correctly treat EIO as EOF.
nix/src/libutil/unix/file-descriptor.cc
Line 101 in e4ce788
| std::string readLine(int fd, bool eofOk, char terminator) |
When the code to use a pty was first added (#2878), special handling of EIO was also added. But it appears that the code for reading the output was later refactored to use readLine without taking into account the possibility of EIO.
Steps To Reproduce
I don't have a straightforward reproduction. I suspect that gvisor may be slower or otherwise have slightly different behavior that significantly increases the chance of this error occurring.
However, the cause seems clear and shouldn't require a reproduction.
Expected behavior
Checklist
- checked latest Nix manual (source)
- checked open bug issues and pull requests for possible duplicates
Add 👍 to issues you find important.