Skip to content

Fixes UnixSocketAddress desynchronization bug on MacOS after calling UnixDatagramChannel#receive#110

Open
mpilquist wants to merge 1 commit intojnr:masterfrom
mpilquist:topic/recvfrom-address-issue
Open

Fixes UnixSocketAddress desynchronization bug on MacOS after calling UnixDatagramChannel#receive#110
mpilquist wants to merge 1 commit intojnr:masterfrom
mpilquist:topic/recvfrom-address-issue

Conversation

@mpilquist
Copy link
Copy Markdown

@mpilquist mpilquist commented May 4, 2026

As of jnr-unixsocket 0.38.25 on MacOS , after calling receive on UnixDatagramChannel, the address length may have been changed. Reusing this address without accounting for a changing in length in subsequent calls (e.g. to send) can result in a no such file error.

We first spotted this issue when upgrading fs2 from 0.38.24 to 0.38.25, where the unit tests would consistently fail on 0.38.25 but only on the MacOS build: typelevel/fs2#3706

This PR handles the address length truncation by doing two things:

  1. After calling recvfrom, updatePath is called with the adjusted length.
  2. The internals of updatePath synchronizes the underlying field when changing the cached path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant