This is an archive of the discontinued LLVM Phabricator instance.

[debugserver] Fix IsUserReady thread filtering
ClosedPublic

Authored by friss on Mar 4 2019, 10:19 AM.

Details

Summary

In 2010 (r118866), filtering code was added to debugserver to avoid reporting threads
that were "not ready to be displayed to the user". This code inspects the thread's
state and discards threads marked 'uninterruptible'. Turns out, this state is pretty
common and not only a characterisitic of 'user-readiness'. This filtering was tracked
down as the source of the flakiness of TestQueues and TestConcurrent* with the symptom
of missing threads.

We discussed with the kernel team and there should be no need for us to filter the
restult of task_threads(). Everything that is returned from there can be examined.
So I went on and tried to remove the filtering completely. This produces other test
failures, where we were reporting more theads than expected. Always threads that had
been terminated, but weren't removed from the task bookkeeping structures yet. Those
threads always had a PC of 0.

This patch changes the heuristic to make the filtering a little less strict and only
rejects threads that are 'uninteruptible' *and* have a PC of 0. This has proven to be
solid in my testing.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

friss created this revision.Mar 4 2019, 10:19 AM

Will this hide a thread that jumps through a null function pointer? That's the only user process case where a pc of 0 needs to be reported to the developer.

friss added a comment.Mar 4 2019, 3:47 PM

Will this hide a thread that jumps through a null function pointer? That's the only user process case where a pc of 0 needs to be reported to the developer.

Nope, I tested this explicitly and when we crash through a NULL pointer the backtrace is correct. Note that the added test is exercised only in the case where the thread state is TH_STATE_UNINTERRUPTIBLE, which seems to be very special (and not what you get when crashed).

jasonmolenda accepted this revision.Mar 4 2019, 3:51 PM

Looks good, that was my only concern.

This revision is now accepted and ready to land.Mar 4 2019, 3:51 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2019, 1:55 PM
Herald added a subscriber: abidh. · View Herald Transcript