Tests fail with "OSError: AF_UNIX path too long" because socket paths exceed max length (107 bytes) #661
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Splitting apart into a separate PR
Unix socket tests were failing with OSError: AF_UNIX path too long. The paths generated by pytest's
tmp_path_factory
fixture on macOS exceed the system max socket path length.On macOS, the unix socket path length limit is 107 bytes; the base temp directory of
/private/var/folders
combined with the subdirectories added bytmp_path_factory
generates paths regularly exceeding this limit by 10+ bytes. Linux also has this limit (108 bytes), but because it's almost always rooted at/tmp
or/var/tmp
it's unlikely to trigger this error. These limits are discussed more here: python/cpython#93852A simple workaround was to use
tempdir.TemporaryDirectory
for socket paths. Even on macOS, these paths are short enough that they shouldn't trigger this error, while still using standard tempdir conventions/locations.I'm unsure why these path lengths aren't an issue on the macOS CI instances; it's very odd they're not. The only major difference I can find is that I'm running Ventura (macOS 13) vs the CI's Monterey (macOS 12); otherwise my pytest version matches up exactly. I also don't see anything in the pytest commit history indicating a change to how tmp_path_factory locations are generated.