Skip to main content

pysigdump

Use signal to show stacktrace and garbage collection stats of a Python process like frsyuki/sigdump.

Usage

Server example to enable sigdump is below:

import os
from wsgiref.simple_server import make_server

import sigdump


def application(env, start_response):
    start_response('200 OK', [('Content-type', 'text/plain; charset=utf-8')])
    return [b'Hello World']


if __name__ == '__main__':
    sigdump.enable(verbose=True)  # just calling sigdump.signal()

    print("pid:", os.getpid())
    httpd = make_server('', 8000, application)
    httpd.serve_forever()
$ python example/wsgi.py
pid: 57650
SIGDUMP is enabled. The result is exported to /tmp/sigdump-82323.log.

Then sending a SIGCONT signal. Please set SIGDUMP_SIGNAL environment variable if you want to change the signal.

$ kill -s SIGCONT 57650

See /tmp/sigdump-<pid>.log. Please set SIGDUMP_PATH environment variable if you want to change the output path. You can set "-" here to dump to STDOUT, or "+" to STDERR.

$ less /tmp/sigdump-57650.log
Sigdump at 2019-12-06 21:04:55.071633 process 57650

  Stacktrace:
  File "example/wsgi.py", line 15, in <module>
    httpd.serve_forever()
  File "/Users/c-bata/.pyenv/versions/3.7.1/lib/python3.7/socketserver.py", line 232, in serve_forever
    ready = selector.select(poll_interval)
  File "/Users/c-bata/.pyenv/versions/3.7.1/lib/python3.7/selectors.py", line 415, in select
    fd_event_list = self._selector.poll(timeout)

   GC stat:
     Generation 0:
       collections   : 33
       collected     : 99
       uncollectable : 0
     Generation 1:
       collections   : 2
       collected     : 253
       uncollectable : 0
     Generation 2:
       collections   : 0
       collected     : 0
       uncollectable : 0

LICENSE

MIT License

Copyright (c) 2016 Masashi SHIBATA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Metadata

Release files for sigdump 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sigdump 0.0.1
File Size Uploaded
sigdump-0.0.1.tar.gz 3.5 kB Details

Release files / sigdump-0.0.1.tar.gz

Download URL sigdump-0.0.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ef9a0ffcff9bacba22878b051837606acbd6b155058925c4151a5fac216c5a94
BLAKE2b-256 checksum
How to use checksums
2cca0ab82cf4ff302b1ab8bfc6123805293fbccbabfb2d77fd63017e6c63b429
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page