Code Monkey home page Code Monkey logo

Comments (3)

blopker avatar blopker commented on June 19, 2024

Hello, this issue is discussed in the README.

from djdt-flamegraph.

jayvdb avatar jayvdb commented on June 19, 2024

Thanks. python ./manage.py runserver --nothreading --noreload worked. Would be nice if it detected this and de-activated itself. It might even be able to be detected in settings.py to avoid listing it in INSTALLED_APPS.

Now I run into #9

from djdt-flamegraph.

jayvdb avatar jayvdb commented on June 19, 2024

I am able to get it to be a bit less problematic with the following; is that worth submitting as-is, maybe with a warning emitted on the console?

 class Sampler(object):
     def __init__(self, interval=0.001):
         self.stack_counts = collections.defaultdict(int)
         self.interval = interval
+        self.disabled = False
 
     def _sample(self, signum, frame):
         stack = []
@@ -87,8 +87,13 @@
         return '\n'.join('%s %d' % (key, value) for key, value in sorted(self.stack_counts.items()))
 
     def start(self):
-        signal.signal(signal.SIGALRM, self._sample)
-        signal.setitimer(signal.ITIMER_REAL, self.interval, self.interval)
+        try:
+            signal.signal(signal.SIGALRM, self._sample)
+            signal.setitimer(signal.ITIMER_REAL, self.interval, self.interval)
+        except ValueError:
+            self.disabled = True
 
     def stop(self):
+        if self.disabled:
+            return
         signal.setitimer(signal.ITIMER_REAL, 0, 0)

from djdt-flamegraph.

Related Issues (7)

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.