Page MenuHomeFreeBSD

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

Authored by wollman on Mar 8 2016, 10:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 6, 6:47 PM
Unknown Object (File)
Tue, Oct 1, 7:43 PM
Unknown Object (File)
Tue, Oct 1, 4:06 PM
Unknown Object (File)
Sep 28 2024, 3:19 PM
Unknown Object (File)
Sep 28 2024, 3:19 AM
Unknown Object (File)
Sep 27 2024, 3:02 PM
Unknown Object (File)
Sep 24 2024, 4:33 PM
Unknown Object (File)
Sep 14 2024, 11:34 PM
Subscribers
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 - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

wollman retitled this revision from to libprocstat: handle race condition while retrieving thread kernel stacks.
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 - subversion.