Skip to content
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

Capture native thread states #1384

Conversation

lemnik
Copy link
Contributor

@lemnik lemnik commented Sep 23, 2021

Goal

Include a list of application threads and their statuses in crashes produced by the NDK plugin. The data reported includes:

  • id
  • name
  • state

for each thread running at the time the report is generated. This reporting can be enabled or disabled using the existing sendThreads option in Configuration.

Design

Scan the /proc/self/task directory to retrieve the list of running tasks / threads using signal-safe functions. The status of these threads is read (where possible) into a pre-allocated buffer of bsg_threads from /proc/self/task/{tid}/stat and mapped to human-readable values where required.

Testing

New unit tests and Mazerunner scenarios to test that the data is reported when expected, and not reported when the configuration forbids it. Manual end-to-end testing has also been done to ensure the data is ingested and rendered as expected.

@lemnik lemnik changed the base branch from next to integration/ROAD-1307/capture-ndk-thread-states September 24, 2021 08:16
@lemnik lemnik force-pushed the PLAT-7239/capture-native-thread-state branch from 59baed6 to 100d2c1 Compare September 24, 2021 08:28
@lemnik lemnik force-pushed the PLAT-7239/capture-native-thread-state branch from 100d2c1 to 497cbdf Compare September 24, 2021 11:08
Copy link
Contributor

@kattrali kattrali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few procedural comments but looks good!

@lemnik lemnik force-pushed the PLAT-7239/capture-native-thread-state branch from 497cbdf to a615a8a Compare September 28, 2021 09:25
@lemnik lemnik merged commit 8e735d1 into integration/ROAD-1307/capture-ndk-thread-states Sep 28, 2021
@lemnik lemnik deleted the PLAT-7239/capture-native-thread-state branch September 28, 2021 11:33
lemnik added a commit that referenced this pull request Sep 28, 2021
* feat(threads): add `bsg_thread` to the NDK plugin (#1371)

* migrate ndk reports for the new threads property (#1376)

* feat(threads): add `bsg_thread` to the NDK plugin

* feat(thread state): migrate v5 ndk reports to the new v6

* Capture native thread states (#1384)

* feat(thread state): capture and report native thread states in NDK crashes

* fix(native threads): native threads obey `Configuration.sendThreads`

* test(native threads): test scenarios for native thread reporting

* fix(native threads): map native thread-status codes to a descriptive string

* fix: updated CHANGELOG for native thread state reporting
lemnik added a commit that referenced this pull request Sep 29, 2021
* docs: correct changelog entry

* test: remove flaky test case

* Capture and report `Thread.state` for Android Runtime threads (#1372)

* feat(threads): capture and report `Thread.state` for Android Runtime threads

* fix(thread state): added nullability annotation to `Thread.State.getDescriptor`

* feat(unity): allow Client to be initialised with the Notifier details for reporting (#1386)

* Capture ndk thread states (#1390)

* feat(threads): add `bsg_thread` to the NDK plugin (#1371)

* migrate ndk reports for the new threads property (#1376)

* feat(threads): add `bsg_thread` to the NDK plugin

* feat(thread state): migrate v5 ndk reports to the new v6

* Capture native thread states (#1384)

* feat(thread state): capture and report native thread states in NDK crashes

* fix(native threads): native threads obey `Configuration.sendThreads`

* test(native threads): test scenarios for native thread reporting

* fix(native threads): map native thread-status codes to a descriptive string

* fix: updated CHANGELOG for native thread state reporting

* v5.14.0

* v5.14.0 - Changelog update

Co-authored-by: fractalwrench <[email protected]>
@lemnik lemnik mentioned this pull request Sep 30, 2021
lemnik added a commit that referenced this pull request Sep 30, 2021
* docs: correct changelog entry

* test: remove flaky test case

* Capture and report `Thread.state` for Android Runtime threads (#1372)

* feat(threads): capture and report `Thread.state` for Android Runtime threads

* fix(thread state): added nullability annotation to `Thread.State.getDescriptor`

* feat(unity): allow Client to be initialised with the Notifier details for reporting (#1386)

* Capture ndk thread states (#1390)

* feat(threads): add `bsg_thread` to the NDK plugin (#1371)

* migrate ndk reports for the new threads property (#1376)

* feat(threads): add `bsg_thread` to the NDK plugin

* feat(thread state): migrate v5 ndk reports to the new v6

* Capture native thread states (#1384)

* feat(thread state): capture and report native thread states in NDK crashes

* fix(native threads): native threads obey `Configuration.sendThreads`

* test(native threads): test scenarios for native thread reporting

* fix(native threads): map native thread-status codes to a descriptive string

* fix: updated CHANGELOG for native thread state reporting

* v5.14.0

* v5.14.0 - Changelog update

Co-authored-by: fractalwrench <[email protected]>

Co-authored-by: fractalwrench <[email protected]>
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 this pull request may close these issues.

3 participants