You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
buffer: test flake on Windows in OwnedImplTypedTest.ReadReserveAndCommit #28177
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)
@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!
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:
set a socket pair to nonblocking at both ends.
write to one socket.
read from the other socket.
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.
(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.
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.
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.
Activity
ravenblackx commentedon Jul 19, 2023
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:
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.
ravenblackx commentedon Jul 19, 2023
(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.
github-actions commentedon Aug 18, 2023
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.
github-actions commentedon Aug 25, 2023
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.