Re: FreeBSD socket.test FAIL: recvmsg() error EAGAIN on accept TCP socket receive

Matthias Andree <[email protected]> Sat, 6 Sep 2025 16:34:41 +0200
Newsgroups gmane.comp.time.chrony.user
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------sl29MKe6XLBcjLUwtRU2pV2k
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Am 28.08.25 um 10:07 schrieb Miroslav Lichvar:
> On Wed, Aug 27, 2025 at 04:50:36PM +0200, Matthias Andree wrote:
>> chrony 4.7 and 4.8 (and possibly others) have an issue with
>> test/util/socket.c's self test,
>> UNLESS running under "truss" (think strace in the Linux world).
>>
>> Apparently we're looking at OS-specific differences WRT non-blocking
>> accept()ed sockets for TCP between FreeBSD and, say, Linux, or with
>> something that a syscall tracer will cause to be retried.
> I have a FreeBSD 14.2 VM that I use for testing and it wasn't failing
> for me. Maybe it's too slow.
>
>> Debugging this, SCK_AcceptConnection unconditionally sets O_NONBLOCK on=
 the
>> socket,
> It should be now fixed in git. Thanks for the report.

Miroslav,

thanks for the prompt reply. I=C2=A0 confirm the fix works for us and have=
=20
pushed it to the FreeBSD ports repository.

>> Speaking of which, configure states that FreeBSD 11.0 had a broken
>> recvmmsg() - have there been bug reports at the time or fixes? Have we
>> retried this on 13.5, 14.2, 14.3? What do we need to look for?
> That bug was fixed, but it seems it's still just a loop around
> recvmsg, not a single system call, which means there is an extra
> system call made and I'm not sure if it's worth it.
>
> https://github.com/freebsd/freebsd-src/blob/main/lib/libsys/recvmmsg.c#L=
80

OK, then indeed we can just talk recvmsg directly if it's not better.

Regards,
Matthias

--------------sl29MKe6XLBcjLUwtRU2pV2k
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF-=
8">
  </head>
  <body>
    <div class=3D"moz-cite-prefix">Am 28.08.25 um 10:07 schrieb Miroslav
      Lichvar:<br>
    </div>
    <blockquote type=3D"cite" cite=3D"mid:aLAOQ1jU3w9FbfKY@localhost">
      <pre wrap=3D"" class=3D"moz-quote-pre">On Wed, Aug 27, 2025 at 04:50=
:36PM +0200, Matthias Andree wrote:
</pre>
      <blockquote type=3D"cite">
        <pre wrap=3D"" class=3D"moz-quote-pre">chrony 4.7 and 4.8 (and pos=
sibly others) have an issue with
test/util/socket.c's self test,
UNLESS running under "truss" (think strace in the Linux world).

Apparently we're looking at OS-specific differences WRT non-blocking
accept()ed sockets for TCP between FreeBSD and, say, Linux, or with
something that a syscall tracer will cause to be retried.
</pre>
      </blockquote>
      <pre wrap=3D"" class=3D"moz-quote-pre">
I have a FreeBSD 14.2 VM that I use for testing and it wasn't failing
for me. Maybe it's too slow.

</pre>
      <blockquote type=3D"cite">
        <pre wrap=3D"" class=3D"moz-quote-pre">Debugging this, SCK_AcceptC=
onnection unconditionally sets O_NONBLOCK on the
socket,
</pre>
      </blockquote>
      <pre wrap=3D"" class=3D"moz-quote-pre">
It should be now fixed in git. Thanks for the report.</pre>
    </blockquote>
    <p>Miroslav,<br>
    </p>
    <p>thanks for the prompt reply. I=C2=A0 confirm the fix works for us a=
nd
      have pushed it to the FreeBSD ports repository.<br>
    </p>
    <p><span style=3D"white-space: pre-wrap">
</span></p>
    <blockquote type=3D"cite" cite=3D"mid:aLAOQ1jU3w9FbfKY@localhost">
      <blockquote type=3D"cite">
        <pre wrap=3D"" class=3D"moz-quote-pre">Speaking of which, configur=
e states that FreeBSD 11.0 had a broken
recvmmsg() - have there been bug reports at the time or fixes? Have we
retried this on 13.5, 14.2, 14.3? What do we need to look for?
</pre>
      </blockquote>
      <pre wrap=3D"" class=3D"moz-quote-pre">
That bug was fixed, but it seems it's still just a loop around
recvmsg, not a single system call, which means there is an extra
system call made and I'm not sure if it's worth it.

<a class=3D"moz-txt-link-freetext" href=3D"https://github.com/freebsd/free=
bsd-src/blob/main/lib/libsys/recvmmsg.c#L80">https://github.com/freebsd/fr=
eebsd-src/blob/main/lib/libsys/recvmmsg.c#L80</a>
</pre>
    </blockquote>
    <p>OK, then indeed we can just talk recvmsg directly if it's not
      better.</p>
    <p>Regards,<br>
      Matthias<br>
    </p>
  </body>
</html>

--------------sl29MKe6XLBcjLUwtRU2pV2k--

-- 
To unsubscribe email chrony-users-request-kWFZVVI9zxvPqho9SqqRMmD2FQJk+8+b@public.gmane.org 
with "unsubscribe" in the subject.
For help email chrony-users-request-kWFZVVI9zxvPqho9SqqRMmD2FQJk+8+b@public.gmane.org 
with "help" in the subject.
Trouble?  Email [email protected]