Comments (6)
It's a known issue but apparently not documented anywhere. Sorry about that. The workaround is to run the development server in single-threaded mode:
$ python manage.py runserver --nothreading --noreload
I am leaving this open to update the documentation.
from django-live-profiler.
Thanks! That helped. I am getting another exception when accessing http://127.0.0.1:8000/profiler/:
EDIT: It sorted out after I restarted the testserver and python profiling works now!
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/profiler/
Django Version: 1.5
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'south',
'profiler',
'grappelli',
'django.contrib.gis',
'django.contrib.admin',
'django.contrib.admindocs',
'endless_pagination',
'debug_toolbar',
'anycluster',
'web')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'profiler.middleware.ProfilerMiddleware',
'profiler.middleware.StatProfMiddleware',
'middleware.ProfilerMiddleware')
Traceback:
File "/srv/www/envs/cwu/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
92. response = middleware_method(request)
File "/srv/www/envs/cwu/src/django-live-profiler/profiler/middleware.py" in process_request
34. statprof.reset(getattr(settings, 'LIVEPROFILER_STATPROF_FREQUENCY', 100))
File "/srv/www/envs/cwu/lib/python2.7/site-packages/statprof.py" in reset
270. assert state.profile_level == 0, "Can't reset() while statprof is running"
Exception Type: AssertionError at /profiler/
Exception Value: Can't reset() while statprof is running
from django-live-profiler.
I'm getting this same error even with --nothreading and --noreload specified. Python 2.7.4, Django 1.5.1, latest django-live-profiler from git commit.
from django-live-profiler.
from django-live-profiler.
--noreload works for me but is there a permanent solution?
from django-live-profiler.
There doesn't appear to be a solution to the threading issue, since statprof
cannot trigger a signal from a child thread.
However, I've updated this library to work on Django 2.2 and fixed a few other issues here, you may find this PR useful: #28
from django-live-profiler.
Related Issues (17)
- Drill by view
- Socket EOFError HOT 1
- redirecting URL to http://localhost:8000/accounts/login/?next=/profiler/ HOT 3
- Collapse long queries
- TypeError: unicode not allowed, use setsockopt_string with python 3.2 on Debian Wheezy HOT 7
- ImportError - No module named defaults HOT 1
- ImportError: cannot import name empty_iter HOT 7
- TypeError: setsockopt() argument 3 must be string or read-only buffer, not None HOT 1
- Reset button
- ImportError while running django server: cannot import name 'empty_iter' from 'django.db.models.sql.compiler'
- Allow sorting views HOT 1
- Measure avg time per HTTP request for SQL queries HOT 4
- Snapshots
- Mongo profiling
- Outgoing HTTP calls profiling
- Significant overhead on code profiling
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-live-profiler.