I'm trying to use posix signals to profile some code in a wsgi worker 
and have discovered that they don't seem to work when there are multiple 
workers. Is this a known issue? Tested with Python 2.7.3 and uWSGI 1.2.4 
on Ubuntu server 12.04.

Here is an example wsgi file:

     import os
     import signal
     import time

     def print_here(signum, frame):
         print "here"

     def application(environ, start_response):
         signal.signal(signal.SIGPROF, print_here)
         signal.setitimer(signal.ITIMER_PROF, 0.001, 0.001)
         os.kill(os.getpid(), signal.SIGPROF)
         print "start", time.time()
         for i in range(1, 10000000):
             inv = 1.0 / i
         print "done", time.time()
         start_response("200 OK", [])
         return ["done"]

When I run with the following configuration, I see multiple "here"s 
printed out:
     $ uwsgi --http 127.0.0.1:8888 --wsgi-file uwsgi.wsgi --workers 1
but when I use multiple workers, all I see is the "start" and "done" 
messages:
     $ uwsgi --http 127.0.0.1:8888 --wsgi-file uwsgi.wsgi --workers 2

Thanks,
- Mike
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to