-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable system diagnostics package 1 for threading info
- cleanup existing debugging stuff - gather linux-specific thread ID so we can correlate threads with their system process info in /proc, top, etc - create general purpose framework for registering more diagnostics functions - add very detailed snapshot printout of per-thread stack traces, run status, thread name, etc (these are heavy weapons for diagnosing hung threads / deadlocks) - add basic memory reporting, more coming later
- Loading branch information
1 parent
9493061
commit 40a0b13
Showing
5 changed files
with
145 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,5 @@ paver==1.2.2 | |
wheel==0.24.0 | ||
pip==1.5.6 | ||
sh==1.09 | ||
python-prctl==1.6.1 | ||
python-prctl==1.6.1 | ||
psutil==4.3.0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import os | ||
|
||
# create a list of status functions which can inspect information of the running process | ||
status_functions = [] | ||
|
||
|
||
def gather_diagnostics_status_information(): | ||
""" | ||
Return textual information about current system state / diagnostics | ||
Useful for debugging threading / db / cpu load / etc | ||
""" | ||
out = '' | ||
for func in status_functions: | ||
out += '--------- {} ---------\n{}\n\n\n'.format(func.__name__.replace('_', ' ').upper(), func()) | ||
return out | ||
|
||
|
||
def register_diagnostics_status_function(func): | ||
status_functions.append(func) | ||
return func | ||
|
||
|
||
def _get_all_session_lock_filenames(): | ||
path_of_this_python_script = os.path.dirname(os.path.realpath(__file__)) | ||
session_path = path_of_this_python_script + "/../data/sessions/" | ||
return [session_path + lockfile for lockfile in os.listdir(session_path) if lockfile.endswith(".lock")] | ||
|
||
|
||
def _debugger_helper_remove_any_session_lockfiles(): | ||
""" | ||
When debugging, if you force kill the server, occasionally | ||
there will be cherrypy session lockfiles leftover. | ||
Calling this function will remove any stray lockfiles. | ||
DO NOT CALL THIS IN PRODUCTION. | ||
""" | ||
for lockfile in _get_all_session_lock_filenames(): | ||
os.remove(lockfile) | ||
|
||
|
||
def debugger_helpers_all_init(): | ||
""" | ||
Prepare sideboard to launch from a debugger. | ||
This will do a few extra steps to make sure the environment is friendly. | ||
DO NOT CALL THIS IN PRODUCTION. | ||
""" | ||
_debugger_helper_remove_any_session_lockfiles() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters