Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Sep 2021 18:56:04 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 258412] kevent EVFILT_TIMER, EV_DISPATCH lost if event is re-enabled
Message-ID:  <bug-258412-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258412

            Bug ID: 258412
           Summary: kevent EVFILT_TIMER, EV_DISPATCH lost if event is
                    re-enabled
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: a.cudbardb@freeradius.org

Currently expanding libkqueue tests.  libkqueue implements kqueue for Linux,
Solaris and Windows as a userland library.

One test - test_kevent_timer_dispatch - appears to fail on both macOS 11.5.2
and FreeBSD 13 but for different reasons.

Test steps are below:

- Add a new timer, EV_SET(kq, 4, EVFILT_TIMER, EV_ADD, EV_DISPATCH, 0, 200,
NULL)
- Call kevent, wait for timer to fire.
- Verify one kevent was returned the the correct flags and data field set t=
o 1.
- Wait 500ms.
- Verify no more kevents are available.

- Re-enable timer, EV_SET(kq, 4, EVFILT_TIMER, EV_ENABLE | EV_DISPATCH, 0, =
200,
NULL)
- Verify no events are generated instantaneously.

The above step fails on FreeBSD 13, we get one event with the data field se=
t to
1.

- Wait 1s
- Check that exactly 1 event has fired.

The above step fails on macOS, we get one event with the data field set to =
5.

Adding EV_ADD to the call re-enabling the timer does nothing, as does only
passing EV_ENABLE.

To run the test suite containing the failing test:

  git clone https://github.com/mheily/libkqueue.git
  cd libkqueue
  cmake . test/CMakeLists.txt -DWITH_NATIVE_KQUEUE_BUGS=3D1
  make -C test/
  ./test/libkqueue-test timer

You'll need the cmake, git, and gcc or llvm pkgs installed.  There are no o=
ther
dependencies.

The actual test is available here:
https://github.com/mheily/libkqueue/blob/935ebc39f78d2e06ce0d20f6c297e4b2b7=
e4c1bc/test/timer.c#L122

I believe FreeBSD pulled in libkqueue's test suite at some point in the dis=
tant
past.  The test framework hasn't changed much in the past 10 years so you m=
ay
be able to just drop the updated test in.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-258412-227>