forked from facebook/folly
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix hhwheeltimer #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ahornby
wants to merge
2
commits into
main
Choose a base branch
from
fix_hhwheeltimer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…fyMmsg Summary: Test fix to reorder members so that we destroy evbs_ before acceptors_ so that onListenStopped not called on a freed UDPAcceptor. Fixes intermitted use after free segfault in test io_async_async_udp_socket_test.AsyncSocketIntegrationTest.PingPongNotifyMmsg [ github CI example](https://github.com/facebook/folly/actions/runs/19988915131/job/57326786353#step:100:7347). Test Plan: Reproduced locally via: ``` while ./build/fbcode_builder/getdeps.py --allow-system-packages test --src-dir=. --retry 0 folly; do echo ok; done ``` Before, fails after a few minutes ``` io_async_async_udp_socket_test.AsyncSocketIntegrationTest.PingPongNotifyMmsg .............................................***Exception: SegFault 0.31 sec Note: Google Test filter = AsyncSocketIntegrationTest.PingPongNotifyMmsg [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from AsyncSocketIntegrationTest [ RUN ] AsyncSocketIntegrationTest.PingPongNotifyMmsg I20251206 17:03:03.273430 472420 AsyncUDPSocketTest.cpp:465] Server listening=127.0.0.1:39115 *** Aborted at 1765040583 (Unix time, try 'date -d @1765040583') *** *** Signal 11 (SIGSEGV) (0x7f9758009) received by PID 472420 (pthread TID 0x7f975cf0cfc0) (linux TID 472420) (code: address not mapped to object), stack trace: *** @ 000000000014ee22 _ZN5folly10symbolizer12_GLOBAL__N_113signalHandlerEiP9siginfo_tPv /home/alex/local/folly/folly/debugging/symbolizer/SignalHandler.cpp:526 @ 000000000004251f (unknown) @ 000000000005e531 _ZN5folly6detail8function5call_IZNS_20AsyncUDPServerSocket12onReadClosedEvEUlvE_Lb1ELb0EvJEEET2_DpT3_RNS1_4DataE /home/alex/local/folly/folly/io/async/AsyncUDPServerSocket.h:342 -> /home/alex/local/folly/folly/io/async/test/AsyncUDPSocketTest.cpp @ 00000000000d61b8 _ZN5folly23AtomicNotificationQueueINS_8FunctionIFvvEEEE5driveIRNS_9EventBase10FuncRunnerEEEbOT_ /home/alex/local/folly/folly/Function.h:370 -> /home/alex/local/folly/folly/io/async/EventBase.cpp @ 00000000000d2762 _ZN5folly9EventBaseD1Ev /home/alex/local/folly/folly/io/async/EventBaseAtomicNotificationQueue-inl.h:275 -> /home/alex/local/folly/folly/io/async/EventBase.cpp @ 00000000000a3a2f _ZN26AsyncSocketIntegrationTestD2Ev /usr/include/c++/11/bits/stl_construct.h:88 -> /home/alex/local/folly/folly/io/async/test/AsyncUDPSocketTest.cpp @ 00000000000a3f16 _ZN50AsyncSocketIntegrationTest_PingPongNotifyMmsg_TestD0Ev /home/alex/local/folly/folly/io/async/test/AsyncUDPSocketTest.cpp:618 @ 000000000022bc2e _ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest.cc:2599 -> /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest-all.cc @ 000000000021c8ac _ZN7testing8TestInfo3RunEv /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest.cc:2859 -> /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest-all.cc @ 000000000021d022 _ZN7testing9TestSuite3RunEv.part.0 /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest.cc:3012 -> /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest-all.cc @ 000000000022222b _ZN7testing8internal12UnitTestImpl11RunAllTestsEv /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest.cc:2986 -> /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest-all.cc @ 000000000022c1f6 _ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest.cc:2599 -> /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest-all.cc @ 000000000021c9ff _ZN7testing8UnitTest3RunEv /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest.cc:5444 -> /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/extracted/googletest-release-1.12.1.tar.gz/googletest-release-1.12.1/googletest/src/ gtest-all.cc @ 000000000004bf4b main /home/alex/local/tmp/ubuntu-22.04/fbcode_builder_getdeps-ZhomeZalexZlocalZfollyZbuildZfbcode_builder/installed/googletest-Hv1WWy2VPcuaFD_4gPiXoC0RaDUVDIVPy0lsa_KINtA/include/gtest/ gtest.h:2293 -> /home/alex/local/folly/folly/test/common/TestMain.cpp @ 0000000000029d8f (unknown) @ 0000000000029e3f __libc_start_main @ 000000000004d2a4 _start ``` After, works for an hour ``` ```
Summary:
Fix intermittent test failure in HHWheelTimerTest.FireOnce , giving the wheel timer enough headroom for occasional wakeup delay while still asserting single‑fire behavior and count reset.
* 5ms wheel timers on a 1ms tick occasionally miss a wake and slip a tick
* Bump to 20/40ms so sporadic poll/timerfd jitter no longer trips the test while still verifying the callbacks fire once and count returns to zero
Test Plan:
Reproduced locally via:
```
while ./build/fbcode_builder/getdeps.py --allow-system-packages test --src-dir=. --retry 0 folly; do echo ok; done
```
Before:
```
/home/alex/local/folly/folly/io/async/test/HHWheelTimerTest.cpp:91: Failure
Failed
Timeout violates constraints, expectedMs = 5, elapsed wall time ms = 11
/home/alex/local/folly/folly/io/async/test/HHWheelTimerTest.cpp:92: Failure
Failed
Timeout violates constraints, expectedMs = 5, elapsed wall time ms = 11
[ FAILED ] HHWheelTimerTest.FireOnce (11 ms)
[----------] 1 test from HHWheelTimerTest (11 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (11 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] HHWheelTimerTest.FireOnce
```
After, works
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.