Skip to content

Missing events due to early return on perfhup #23

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

Open
pwaller opened this issue May 10, 2020 · 0 comments
Open

Missing events due to early return on perfhup #23

pwaller opened this issue May 10, 2020 · 0 comments

Comments

@pwaller
Copy link
Contributor

pwaller commented May 10, 2020

I've been messing around with perf, using inherit to trace a process tree.

What I've found is that when the process tree exits, we get HUP on the poll, and whatever events are in the kernel buffer at that time are lost.

I'm not sure I fully understand what's going on, but I've found anecdotally that here:

perf/record.go

Lines 130 to 133 in 6861f4b

if resp.perfhup {
// Saw POLLHUP on ev.perffd. See also the
// documentation for ErrDisabled.
return ErrDisabled

If I insert:

if ev.readRawRecordNonblock(raw) {
	return nil
}

Before return ErrDisabled, then it appears the events are not lost.

This was referenced May 10, 2020
pwaller added a commit to pwaller/acln0-perf that referenced this issue May 10, 2020
Previously, if poll returned HUP, we would immediately return ErrDisabled, but
this means we could miss events if there are events waiting in the buffer.

Fixes: acln0#23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant