[Question] Sampling inside gunicorn gevent worker.
Hello,
Is this sampling strategy supposed to work in "gevent-driven" environment, like gunicorn gevent worker? I've tried it in our system, and looks like that after several minutes of sampling it just hangs somewhere in _sample, probably in while loop (other application code is working as expected).
Thanks.
Aw that's no good! We run the sampler in heavily gevent-dependent applications without any issues; I'm not sure offhand what the issue might be. What versions of gunicorn and gevent are you using? Do you have any other OS-signal-handling code in your application (in particular for SIGVTALRM)?
+1 can someone talk about how to integrate this in a gunicorn based deployment ? currently we use cprofile and use it like this
def post_fork(server, worker):
# Patch psycopg for gevent after we fork.
psycogreen.gevent.patch_psycopg()
worker.log.info('Made psycopg green: psycogreen.gevent.patch_psycopg')
orig_init_process_ = worker.init_process
def profiling_init_process(self):
orig_init_process = orig_init_process_
ofile = '%s%s' % (profiling_prefix, getpid())
print 'Profiling worker %s, output file: %s' % (worker, ofile)
cProfile.runctx('orig_init_process()', globals(), locals(), ofile)
worker.init_process = profiling_init_process.__get__(worker)
we then use runsnakerun to view it. would love to use nylas