New issue
Advanced search Search tips

Issue 626534 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug



Sign in to add a comment

macOS Sierra warning: kq_init: detected broken kqueue; not using.: Undefined error: 0

Project Member Reported by erikc...@chromium.org, Jul 8 2016

Issue description

There are two warnings that require further investigation, upon launching Chromium on 10.12.

[0707/201006:WARNING:memory_mac.mm(531)] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650

[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0

 

Comment 1 by mark@chromium.org, Jul 8 2016

Summary: macOS Sierra warning: kq_init: detected broken kqueue; not using.: Undefined error: 0 (was: Research macOS Sierra warnings.)
Splitting the CFAllocator portion into  bug 626536 , so that this can focus on the kqueue part.

Comment 2 by mark@chromium.org, Jul 8 2016

I’m at home and don’t have a whole Chromium build that I can mess with, but I would have been very surprised if this old 10.4 bug that libevent was working around suddenly reappeared in 10.12. Here’s the relevant bit of libevent:

https://chromium.googlesource.com/chromium/src/+/c7ebe6daa79da2e351345065020cc7f216126f15/base/third_party/libevent/kqueue.c#143

Right off the bat, line 156 looks suspect. That should test struct kevent::flags & EV_ERROR, not struct kevent::flags == EV_ERROR.

I wrote a small test that followed this approach and told me what we got back from kevent.

rv = 1
struct kevent::ident = -1
struct kevent::flags = 0x4001
struct kevent::data = 9

From <sys/event.h>:

#define EV_ADD              0x0001              /* add event to kq (implies enable) */
#define EV_ERROR            0x4000              /* error, data contains errno */

and <sys/errno.h>:

#define EBADF           9               /* Bad file descriptor */

So it looks like in 10.12, for errors, |flags| coming out of eventlist contains the original value of |flags| on the way into kevent() as passed in changelist. EV_ERROR is ORed into this value.

The documentation for kevent() supports this:

RETURN VALUES
     […]
     The kevent(), kevent64() and kevent_qos() system calls return the number
     of events placed in the eventlist, up to the value given by nevents.  If
     an error occurs while processing an element of the changelist and there
     is enough room in the eventlist, then the event will be placed in the
     eventlist with EV_ERROR set in flags and the system error in data. […]

Evidently, previous OS versions didn’t do this, they just set EV_ERROR and nothing else in the flags field.

Fixing the test in libevent’s kqueue.c should reenable kqueues in libevent on 10.12. Hopefully it will also fix  bug 620259 . I’ll take a look at this tomorrow when I’m in front of a Chromium build, unless someone beats me to it.
mark: Making your suggested change removes the warning, and also fixes the hang on shutdown bug.

Comment 4 by mark@chromium.org, Jul 8 2016

Owner: erikc...@chromium.org
Status: Started (was: Available)
https://codereview.chromium.org/2134603002/
Project Member

Comment 5 by sheriffbot@chromium.org, Jul 8 2016

Labels: -M-53 M-54 MovedFrom-53
Moving this nonessential bug to the next milestone.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 6 by mark@chromium.org, Jul 8 2016

Labels: -M-54 -MovedFrom-53 M-53

Comment 7 by mark@chromium.org, Jul 8 2016

Reported upstream at https://github.com/libevent/libevent/issues/376.
Project Member

Comment 8 by bugdroid1@chromium.org, Jul 8 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3b07cd446f6bf33618ebae11ca68273b7a0de2f8

commit 3b07cd446f6bf33618ebae11ca68273b7a0de2f8
Author: erikchen <erikchen@chromium.org>
Date: Fri Jul 08 17:06:18 2016

Fix a logic bug in kqueue.c.

Remove an unnecessary workaround for OS X 10.4 from kqueue.c. It was causing
problems on macOS Sierra.

All credit for this CL goes to mark@chromium.org.

BUG= 626534 ,  620259 

Review-Url: https://codereview.chromium.org/2134603002
Cr-Commit-Position: refs/heads/master@{#404421}

[modify] https://crrev.com/3b07cd446f6bf33618ebae11ca68273b7a0de2f8/base/third_party/libevent/README.chromium
[modify] https://crrev.com/3b07cd446f6bf33618ebae11ca68273b7a0de2f8/base/third_party/libevent/kqueue.c

Labels: Merge-Request-53
Status: Fixed (was: Started)

Comment 11 by dimu@google.com, Jul 9 2016

Labels: -Merge-Request-53 Merge-Approved-53 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M53 (branch: 2785)
Project Member

Comment 12 by bugdroid1@chromium.org, Jul 11 2016

Labels: -merge-approved-53 merge-merged-2785
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/45a5e0217612dfb48e8c3fd5dcd7e186d8288c52

commit 45a5e0217612dfb48e8c3fd5dcd7e186d8288c52
Author: erikchen <erikchen@chromium.org>
Date: Mon Jul 11 17:21:58 2016

Fix a logic bug in kqueue.c.

Remove an unnecessary workaround for OS X 10.4 from kqueue.c. It was causing
problems on macOS Sierra.

All credit for this CL goes to mark@chromium.org.

BUG= 626534 ,  620259 

Review-Url: https://codereview.chromium.org/2134603002
Cr-Commit-Position: refs/heads/master@{#404421}
(cherry picked from commit 3b07cd446f6bf33618ebae11ca68273b7a0de2f8)

Review URL: https://codereview.chromium.org/2140723002 .

Cr-Commit-Position: refs/branch-heads/2785@{#83}
Cr-Branched-From: 68623971be0cfc492a2cb0427d7f478e7b214c24-refs/heads/master@{#403382}

[modify] https://crrev.com/45a5e0217612dfb48e8c3fd5dcd7e186d8288c52/base/third_party/libevent/README.chromium
[modify] https://crrev.com/45a5e0217612dfb48e8c3fd5dcd7e186d8288c52/base/third_party/libevent/kqueue.c

Comment 14 Deleted

Sign in to add a comment