Commit a1a273b
Fix flaky OverloadTest::Test by using Baton synchronization
Summary:
The test was flaky because it used a race-prone polling loop with `std::this_thread::yield()` to wait for a request to become active. This approach had several issues:
1. No timeout/deadline - could loop infinitely in edge cases
2. Race condition - checking `getActiveRequests() >= 1` doesn't guarantee the request has actually entered the blocking handler
3. Very short queue timeout (10ms) that could race with the polling
Fix by using explicit `folly::Baton` synchronization:
- Added an `entered` baton to `BlockInterface` that signals when a request has entered `voidResponse()`
- Use `try_wait_for(5s)` instead of spin-waiting with yield
- Increased queue timeout to 1s since synchronization is now explicit
Reviewed By: tlj77
Differential Revision: D94309711
fbshipit-source-id: 9cafb07a8ef1a4682f330c5d4bac17387b7308001 parent 9e4ddd3 commit a1a273b
1 file changed
Lines changed: 12 additions & 13 deletions
Lines changed: 12 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2057 | 2057 | | |
2058 | 2058 | | |
2059 | 2059 | | |
2060 | | - | |
2061 | | - | |
| 2060 | + | |
2062 | 2061 | | |
2063 | 2062 | | |
2064 | 2063 | | |
2065 | | - | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
2066 | 2069 | | |
2067 | 2070 | | |
2068 | 2071 | | |
2069 | 2072 | | |
2070 | 2073 | | |
2071 | 2074 | | |
2072 | 2075 | | |
2073 | | - | |
| 2076 | + | |
| 2077 | + | |
2074 | 2078 | | |
2075 | 2079 | | |
2076 | 2080 | | |
| |||
2094 | 2098 | | |
2095 | 2099 | | |
2096 | 2100 | | |
2097 | | - | |
2098 | 2101 | | |
2099 | 2102 | | |
2100 | 2103 | | |
2101 | | - | |
2102 | 2104 | | |
2103 | | - | |
2104 | | - | |
2105 | | - | |
| 2105 | + | |
2106 | 2106 | | |
2107 | | - | |
2108 | | - | |
2109 | | - | |
2110 | | - | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
2111 | 2110 | | |
2112 | 2111 | | |
2113 | 2112 | | |
| |||
0 commit comments