vibe-d / eventcore

High performance proactor event loop abstraction library
MIT License
60 stars 42 forks source link

Fix possible hangs in the CFRunLoop driver #193

Closed s-ludwig closed 3 years ago

Geod24 commented 3 years ago

Failed the relevant job (cfrunloop), I re-triggered to see if it's spurious:

Running ../../../../../var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/.dub/build/test-~master/application-debug-posix.osx-x86_64-ldc_2087-57DFF3775D97BABB28C115198F1D2C23/test 
core.exception.AssertError@tests/issue-25-periodic-timers.d(48): 101 ms, 657 μs, and 6 hnsecs
----------------
??:? _d_assert_msg [0x105074796]
issue-25-periodic-timers.d:48 nothrow @safe void test.main().periodicCallback(eventcore.driver.TimerID) [0x104eb4a61]
driver.d:717 nothrow @safe void eventcore.driver.EventDriverTimers.wait(eventcore.driver.TimerID, void delegate(eventcore.driver.TimerID) nothrow @safe).__lambda3!(eventcore.driver.TimerID, bool).__lambda3(eventcore.driver.TimerID, bool) [0x104ec9de6]
timer.d:80 nothrow @safe int eventcore.drivers.timer.LoopTimeoutTimerDriver.process(core.time.MonoTimeImpl!(0).MonoTimeImpl).__foreachbody3(ref eventcore.drivers.timer.TimerSlot*) [0x104f0df14]

I'm seeing zombies when running locally and Ctrl+Cing, could this be why ?

s-ludwig commented 3 years ago

I'm seeing zombies when running locally and Ctrl+Cing, could this be why ?

I unfortunately couldn't reproduce the zombies or the timer test failure locally - neither with the current LDC, nor with 1.17.0. However, the same failure has occurred for a lot of commits on master in the past, always with LDC 1.17.0 or 1.16.0, so I think we can safely ignore it for this PR. There seems to be something with the macOS VMs that generally results in very imprecise timing.

Geod24 commented 3 years ago

I don't think the bug I'm seeing is related to the LDC version, as I'm seeing it with the latest. So the CI failure is probably a different thing. In any case, since you are looking at CFRunLoop, I created an issue which reproduces the problem: https://github.com/vibe-d/vibe.d/issues/2596

s-ludwig commented 3 years ago

Opened a PR for the shutdown issue: https://github.com/vibe-d/vibe-core/pull/292