GithubHelp home page GithubHelp logo

stackimpact / stackimpact-python Goto Github PK

View Code? Open in Web Editor NEW
659.0 10.0 25.0 82 KB

DEPRECATED StackImpact Python Profiler - Production-Grade Performance Profiler: CPU, memory allocations, blocking calls, exceptions, metrics, and more

Home Page: https://stackimpact.com

License: BSD 3-Clause "New" or "Revised" License

Python 99.71% Shell 0.29%
python python3 profiler memory-leak-detection memory-profiler cpu-profiler performance-tuning performance-metrics monitoring hot-spot-profiles

stackimpact-python's People

Contributors

dmelikyan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stackimpact-python's Issues

BufferError with Tornado and asyncio

Problem

Since adding the StackImpact agent to a Tornado/asyncio application, we started seeing BufferErrors like this:

BufferError: Existing exports of data: object cannot be re-sized
  File "tornado/web.py", line 1513, in _execute
    self.finish()
  File "tornado/web.py", line 991, in finish
    self.flush(include_footers=True)
  File "tornado/web.py", line 947, in flush
    start_line, self._headers, chunk, callback=callback)
  File "tornado/http1connection.py", line 400, in write_headers
    self._pending_write = self.stream.write(data)
  File "tornado/iostream.py", line 406, in write
    self._handle_write()
  File "tornado/iostream.py", line 872, in _handle_write
    del self._write_buffer[:self._write_buffer_pos]

Environment

Our application runs inside a Docker container. We use:

  • Python 3.6.1
  • tornado 4.5.1
  • stackimpact 1.0.0

We start it like this (simplified for brevity):

import asyncio

from tornado.platform.asyncio import AsyncIOMainLoop
from tornado.httpserver import HTTPServer
from tornado.web import Application


if __name__ == '__main__':
    AsyncIOMainLoop().install()
    loop = asyncio.get_event_loop()

    app = Application(...)
    server = HTTPServer(app)
    server.listen(8080)

    internal_app = Application(...)
    internal_server = HTTPServer(app)
    internal_server.listen(8081)

    loop.run_forever()

Notes

Cursory googling turned up the same error happening in the same place, as reported in this comment on a Tornado pull request. I don't know enough about Tornado's internals to guess at what's going on here but maybe @bdarnell can provide more insight.

In any case, I'm happy to provide more details as needed.

Django integration on settings.py

My app is django+gunicorn+gevent. In gunicorn, it runs 9 processes.

I insert stackimpact.start() in settings.py. My app can start and data is coming as well. However, when I run command line, say, ./manage.py migrate, it stuck there can not exit. If I use keyboard ctrl-c to terminate, the error stack is:

^CException ignored in: <module 'threading' from '/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py'>
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 1281, in _shutdown
    t.join()
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 1032, in join
    self._wait_for_tstate_lock()
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 1048, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
  File "/Users/dapeng/.local/share/virtualenvs/Plato-XLrv9cCz/lib/python3.7/site-packages/stackimpact/runtime.py", line 139, in _handler
    prev_handler(signum, frame)
KeyboardInterrupt

As this migration is on our CI pipeline, we cannot manually to terminate it. How can I avoid that? What is the correct way use stackimpact with django?

Running a deamonized app

I use a daemon to run my app (something like that), and it seems it is not really working.

I first tried to initiate stackimpact at the top of my core module as shown in the examples, but could not run my app as a service anymore as stackimpact was not deamonized along other stuff (makes sense). I then tried to initiate stackimpact in run(), but I don't get any data. I think stackimpact is not really designed to work like that, I would be curious if there is a way to make it work.

Env is Python 3.5.2, stackimpact v1.0.1

Would be happy to provide more details if needed.

Signal SIGUSR2 not available on Windows

For development we use some boxes with Windows. Currently trying to include start agent on Windows produces self-explaining error

File "...\stackimpact\agent.py", line 113, in start register_signal(signal.SIGUSR2, _signal_handler) AttributeError: module 'signal' has no attribute 'SIGUSR2'

Is it safe to disable this signaling for Win? Unfortunately I am not sure for what is actually SIGUSR2 used in stackimpact so not providing PR.

stackimpact python agent is causing threading issues

archlinux python 3.6 x64

self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._socket.connect((address, port))
self._socket.setblocking(1)
..... etc etc

all works fine
as soon as i add right at the top of the script

agent = stackimpact.start(
agent_key = '...............................',
app_name = 'abc.connect')

my app tries to send stuff before it finished receiving and so on and it all goes south.
when my app is supposed to have a serial behavior, send receive send more receive send receive.. no parallel stuff and definitely not send before it finished receiving.

is there any way to run stackimpact in an app that uses socket lib ?

Fix simple typo: previousely -> previously

Issue Type

[x] Bug (Typo)

Steps to Replicate

  1. Examine README.md, README.rst.
  2. Search for previousely.

Expected Behaviour

  1. Should read previously.

Semi-automated issue generated by
https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

To avoid wasting CI processing resources a branch with the fix has been
prepared but a pull request has not yet been created. A pull request fixing
the issue can be prepared from the link below, feel free to create it or
request @timgates42 create the PR. Alternatively if the fix is undesired please
close the issue with a small comment about the reasoning.

https://github.com/timgates42/stackimpact-python/pull/new/bugfix_typo_previously

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.