Skip to content
Snippets Groups Projects
Unverified Commit ba14537e authored by Will Chandler's avatar Will Chandler
Browse files

hooks: Fix flaky test on MacOS

We have observed intermittent failures on
`TestServer_PackObjectsHook_separateContext` on our MacOS runners. The
error occurs ~10% of the time on MacOS, but has been completely
unreproducible on Linux.

This appears to be a long-standing issue with FreeBSD, dating back to
2005[0], which MacOS has inherited. Unix domain sockets that are closed
after a partial read may return `ENOTCONN`, instead of `EPIPE` as seen
on Linux. This is exactly the scenario performed in this test.

Using the original reproduction script provided in the linked bug
report, the `ENOTCONN` issue occurs ~10% of the time, matching Gitaly's
failure rate.

Given that this functionality works as expected on Linux and the OS
itself is what is non-deterministic, the simplest fix is to accept
either `EPIPE` or `ENOTCONN` when on MacOS. We are forced to check for
the expected error string instead of `errors.Is(err, syscall.ENOTCONN)`
as the syscall information is lost when returned over gRPC to the test
program.

[0] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=79138
parent 1aef8477
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment