Page MenuHomeFreeBSD

Make `server_cat(..)` handle short receives
ClosedPublic

Authored by ngie on Feb 14 2019, 1:04 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 17 2024, 1:38 PM
Unknown Object (File)
Jan 19 2024, 5:26 AM
Unknown Object (File)
Jan 14 2024, 5:40 AM
Unknown Object (File)
Dec 22 2023, 11:22 PM
Unknown Object (File)
Sep 5 2023, 5:42 PM
Unknown Object (File)
Jul 4 2023, 7:43 AM
Unknown Object (File)
Jul 4 2023, 7:43 AM
Unknown Object (File)
Jul 4 2023, 7:41 AM
Subscribers

Details

Summary

In short, the prior code was far too simplistic when it came to calling recv(2)
and failed intermittently (or in the case of Jenkins, deterministically).

Handle short recv(2)s by checking the return code and incrementing the window
into the buffer by the number of received bytes. If the number of received
bytes <= 0, then bail out and test the total number of received bytes vs the
expected number of bytes sent for equality and base whether or not the test
passes/fails on that fact.

Remove the expected failure, now that the testcase deterministically
passes [1].

PR: 234809 [1], 235200
MFC after: 1 week

Test Plan
  • kyua test passes all testcases, sans the ones expected to fail in bug 232210.
  • make tinderbox passed.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lib/libc/tests/sys/sendfile_test.c
159 ↗(On Diff #53901)

Was this needed, or just defensive?

210 ↗(On Diff #53901)

#define seems strange here when it's just used once in the calculation of buffer_size below

lib/libc/tests/sys/sendfile_test.c
159 ↗(On Diff #53901)

I needed to add this, otherwise it would doubleprint the messages. It's an unfortunate side-effect from using ATF I think :/...

210 ↗(On Diff #53901)

I wanted to provide a #define so the constant was self-documenting, but I could move it down to the initialization, along with the comment though.

LGTM!

lib/libc/tests/sys/sendfile_test.c
220 ↗(On Diff #54034)

So the intent of the + 10 is to ensure that when recv_ret == 0, it's because everything sent was received rather than we simply ran out of space in the receive buffer?

This revision is now accepted and ready to land.Feb 19 2019, 7:23 PM
ngie marked an inline comment as done.Feb 19 2019, 7:26 PM
ngie added inline comments.
lib/libc/tests/sys/sendfile_test.c
220 ↗(On Diff #54034)

That's absolutely correct :)! I wanted to make sure that the interface functioned as designed and not purely by accident by adding in additional buffer to capture accidental "over sends". If I set the buffer to the exact size of the expected message, I couldn't test for that.

ngie marked an inline comment as done.Feb 19 2019, 7:27 PM
This revision was automatically updated to reflect the committed changes.