Page MenuHomeFreeBSD

unix/stream: repair SO_SNDTIMEO
ClosedPublic

Authored by glebius on Tue, Oct 14, 4:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 9, 5:09 PM
Unknown Object (File)
Thu, Oct 30, 2:16 PM
Unknown Object (File)
Sun, Oct 26, 9:35 AM
Unknown Object (File)
Sun, Oct 26, 9:35 AM
Unknown Object (File)
Sun, Oct 26, 9:35 AM
Unknown Object (File)
Sun, Oct 26, 9:34 AM
Unknown Object (File)
Thu, Oct 23, 11:39 AM
Unknown Object (File)
Tue, Oct 21, 9:17 AM
Subscribers

Details

Summary

The send operations are waiting on the peer's socket buffer, but we shall
use our timeout value. Provide a test for that.

Fixes: d15792780760ef94647af9b377b5f0a80e1826bc
Reported by: phk

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Do we not block at all when sending on a dgram socket and the receiver has insufficient space?

asomers requested changes to this revision.Tue, Oct 14, 1:58 PM

I have two comments in addition to the inline ones:

  1. The commit message says "repair". That implies that the sockopt used to work but no longer does. If that's true, can you please include in your commit message the hash of the commit that broke it?
  2. One-second sleeps in test suites can add up to a lot. You probably don't need to sleep for so long in order to test the sock opt. Can you reduce the sleep time? FWIW I use 0.1s sleeps in the fusefs test suite and I've heard no complaints there.
  3. What exactly was the old behavior that you are correcting? Did we wait forever, ignoring the sockopt?
tests/sys/kern/unix_stream.c
501

Why use a macro here? It could just be a constant.

509

If this is testing the errno returned by send, then it should come before the second clock_gettime call.

511

I think that this assertion will be unreliable. The time difference could be anything greater than or equal to SECONDS. So you should check like this:

This revision now requires changes to proceed.Tue, Oct 14, 1:58 PM

This was found by Varnish Cache testcase s00012, which passes on 14.3p4 and fails on 15.0-ALPHA5 (Those are the best coordinates I have)

Failure mode is that the socket option is ignored and we never time out.

  • Improve test per Alan's review.

Do we not block at all when sending on a dgram socket and the receiver has insufficient space?

Yes, datagram shall not block. It returns ENOBUFS when receiver has no space. This is a historical behavior and once I tried to change that ENOBUFS, and there was a lot of fallout on different application sides. Go runtime in the first place.

This revision is now accepted and ready to land.Tue, Oct 14, 5:06 PM
This revision was automatically updated to reflect the committed changes.

Confirming that Varnish-Cache test s00012 pass on main-n281191-84333aada464