Skip to content

Commit

Permalink
Send SIGUSR1 signal periodically to only main thread
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 578305415
  • Loading branch information
SurbhiJainUSC authored and copybara-github committed Oct 31, 2023
1 parent 5fd96c3 commit 414de25
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions pip_package/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ To release a new version (e.g. from `1.0.0` -> `2.0.0`):
-->

## [0.1.3] - 2023-11-01
* Fixing issue with using signals and threads together in a program

## [0.1.2] - 2023-09-20
* Improved stack trace readability and clarity by adding a message for more information

Expand All @@ -46,6 +49,7 @@ To release a new version (e.g. from `1.0.0` -> `2.0.0`):
* Initial release of cloud-tpu-diagnostics PyPI package
* FEATURE: Contains debug module to collect stack traces on faults

[0.1.3]: https://github.com/google/cloud-tpu-monitoring-debugging/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/google/cloud-tpu-monitoring-debugging/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/google/cloud-tpu-monitoring-debugging/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/google/cloud-tpu-monitoring-debugging/releases/tag/v0.1.0
6 changes: 2 additions & 4 deletions pip_package/cloud_tpu_diagnostics/src/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def stop_debugging(debug_config):


def send_user_signal(stack_trace_interval_seconds):
"""Send SIGUSR1 signal to non-daemon threads after every stack_trace_interval_seconds seconds."""
"""Send SIGUSR1 signal to main thread after every stack_trace_interval_seconds seconds."""
while True:
time.sleep(stack_trace_interval_seconds)
for thread in threading.enumerate():
if not thread.daemon:
signal.pthread_kill(thread.ident, signal.SIGUSR1)
signal.pthread_kill(threading.main_thread().ident, signal.SIGUSR1)
2 changes: 1 addition & 1 deletion pip_package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

[project]
name = "cloud-tpu-diagnostics"
version = "0.1.2"
version = "0.1.3"
authors = [
{ name="Cloud TPU Team", email="[email protected]" },
]
Expand Down

0 comments on commit 414de25

Please sign in to comment.