Avoid deadlocks after fork - #303
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
bcb913a to
2a70190
Compare
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
2a70190 to
9cc08d6
Compare
9cc08d6 to
67c0d0f
Compare
67c0d0f to
9c28979
Compare
e249b48 to
4121230
Compare
d0d9c81 to
eec0536
Compare
eec0536 to
6422d23
Compare
6422d23 to
03a36bc
Compare
|
Tests failed due to a network error. |
| if (result == -1) | ||
| { | ||
| if (errno != EINTR) | ||
| _exit(EXIT_FAILURE); |
There was a problem hiding this comment.
I wonder if we should just return an error here and not directly exit.
Doing the exit in safe_log_and_exit / safe_log_errno_and_exit might be more obvious.
There was a problem hiding this comment.
I think it would be more "correct" but it also means we would have to add a lot of error checking which makes the later functions less clear. Since it's in a private namespace personally I would just leave it as is
|
|
||
| void safe_log_errno_and_exit(std::initializer_list<std::string_view> parts) | ||
| { | ||
| for (auto part : parts) |
There was a problem hiding this comment.
Should we first assemble the message in a buffer, to avoid having this split across multiple lines?
The alternative would be we accept this in favour of keeping the code as simple as possible.
What do you think @danth @paulquiring ?
There was a problem hiding this comment.
I think we should keep it simple
03a36bc to
8402f02
Compare
The executable could be incorrectly seen as missing if it is on a filesystem which has not been mounted yet. `execve` already fails if the executable does not exist so there is no need to check in advance.
8402f02 to
e66cd1f
Compare
Fork only copies the current thread, so from that point on we could deadlock if we access anything that was locked by another thread at the time of the fork.
According to
man 2 forkwe should only use async signal safe functions betweenforkandexecve.