Page MenuHomeFreeBSD

libprocstat: handle race condition while retrieving thread kernel stacks
Needs ReviewPublic

Authored by wollman on Mar 8 2016, 10:45 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

When retrieving kernel stacks using sysctl (as for procstat -kk on a running kernel), thread creation can race with allocating the buffer to hold the sysctl results, so the operation fails with [ENOMEM]. As a heuristic, assume that the number of threads (and thus the required buffer size) will at most double during this interval.

Test Plan

I have a machine where this happens somewhat regularly with nfsd and will be installing it there to see if the errors go away completely.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

wollman retitled this revision from to libprocstat: handle race condition while retrieving thread kernel stacks.Mar 8 2016, 10:45 PM
wollman updated this object.
wollman edited the test plan for this revision. (Show Details)
wollman set the repository for this revision to rS FreeBSD src repository.
wollman updated this revision to Diff 14180.