Skip to content

buffer: test flake on Windows in OwnedImplTypedTest.ReadReserveAndCommit #28177

Closed as not planned

Description

@jmarantz

Here's a test flake that has been appearing recently in test/common/buffer/owned_impl_test.cc:

[ RUN      ] OwnedImplTypedTest/0.ReadReserveAndCommit
test/common/buffer/owned_impl_test.cc(1389): error: Expected equality of these values:
  result.return_value_
    Which is: 0
  static_cast<uint64_t>(rc)
    Which is: 1
Stack trace:
  00007FF7BA1AF5B6: (unknown)
  00007FF7BA1C7D88: (unknown)
  00007FF7BA1C7F4D: (unknown)
  00007FF7BA1C89BD: (unknown)
... Google Test internal frames ...

[  FAILED  ] OwnedImplTypedTest/0.ReadReserveAndCommit, where TypeParam = class Envoy::Network::IoSocketHandleImpl (1 ms)

Recent failure timing here:
Screenshot 2023-06-28 at 8 37 53 PM

@phlax FYI

@weisisea I am not claiming this particular regression is necessarily due to the change you made, but yours is the last change to this test: #25695 and there have been no recent changes to the impl. Given that, would you be able to investigate this issue? Thank you!

Activity

  1. ravenblackx commented on Jul 19, 2023

    @ravenblackx
    Contributor

    Looking at the two impacted tests, I think the test is actually undefined behavior that should be expected to be flaky, and it's merely an implementation detail of non-windows that it happens to not be.

    Both of the problem test cases perform the sequence:

    1. set a socket pair to nonblocking at both ends.
    2. write to one socket.
    3. read from the other socket.
    4. expect that the read is of the same length as the write.

    Since steps 2 and 3 are nonblocking, the expectation that the read completes, and the expectation that it has all the written data, should both be not guaranteed (and it turns out, on Windows, they are not!)

    I'm not sure why these tests involve sockets at all, so the minimal change I would suggest to make them less undefined (while retaining the overall behavior in case it's important) would be to either perform the read operation blocking, or to put it in a loop with a small delay and only exit the loop when the expected amount of data has been read or a timeout occurs indicating test failure.

  2. ravenblackx commented on Jul 19, 2023

    @ravenblackx
    Contributor

    (Actually even if the write was blocking this would still be undefined behavior since there's no guarantee that data has arrived at the other socket, when a write operation completes. Only the read being blocking or looped would resolve the race.)
    Edit: even a blocking read would not guarantee success because a blocking read can return partial data. So blocking or not, a read-loop would be required to guarantee that the full length has been read.

  3. github-actions commented on Aug 18, 2023

    @github-actions

    This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

  4. added
    stale
    on Aug 18, 2023
  5. github-actions commented on Aug 25, 2023

    @github-actions

    This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.

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

Metadata

Metadata

Assignees

Labels

area/test flakesstale

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions