problem about gevent-Collection of common programming errors


  • tldr
    javascript python node.js exception-handling gevent
    Someone at a meetup yesterday told me that if a callback throws an exception in Node.js, it will crash the entire process. But if a greenlet throws an uncaught exception in Gevent, it only crashes the greenlet. I don’t have experience with Gevent, and am wondering if that is true.

  • Ivan Kovacevic
    python urllib2 gevent
    I’m trying to build a proxy/cache server for one location autocompletion api. Here is the simplified code that manifests the error almost all the time I try to query my server:#!/usr/bin/python import gevent from gevent import monkey from gevent.wsgi import WSGIServer monkey.patch_all()import urllib2 import urlparse import jsondef requestHandler(env, start_response):start_response(‘200 OK’, [(‘Content-Type’, ‘text’)])parameters = urlparse.parse_qs(env[‘QUERY_STRING’])if ‘search’ in parameters:se

  • Kate Gregory
    python exception gevent
    i’m working with an application written in python using gevent. i want it to exit immediately as a result of any exception that i haven’t explicitly trapped. it looks like i’d have to patch the core gevent code.is there any way can i do this in my app, without patching gevent or greenlet?

  • Chrome
    python gevent
    I have code:import gevent import gevent.monkey; gevent.monkey.patch_all() import requestsdef func():try:requests.get(‘http://unavailable-host/’)except:passdef main():jobs = [gevent.spawn(func) for i in xrange(10)]gevent.joinall(jobs)if __name__ == ‘__main__’:main()This script usually nothing output. But sometimes (in 1 of 5 runs) i get this message:Unhandled exception in thread started by sys.excepthook is missing lost sys.stderrExplain me, why this happen, and what is right solution? Also, if I

  • Mansour
    python tornado gevent
    When running tornado’s WSGIApplication through gevent’s pywsgi server, the exceptions in greenlets are suppressed and do not show up in the standard error/output. I have looked and looked and couldn’t find why this is happening.Here’s a little test app to demonstrate:#!/usr/bin/env pythonimport gevent.monkey gevent.monkey.patch_all()import gevent.wsgi import tornado.web import tornado.wsgiclass MainHandler(tornado.web.RequestHandler):def prepare(self):# this next line will cause a NameErrora = i

  • Vimos
    python gevent
    When I run an example of gevent, I get import error here. I am using macos, gevent is installed by pip.Python 2.7.2 (default, Oct 11 2012, 20:14:37) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin Type “help”, “copyright”, “credits” or “license” for more information. >>> import gevent >>> from gevent import socket >>> urls = [‘www.google.com’, ‘www.example.com’, ‘www.python.org’] >>> jobs = [gevent.spawn(socket.gethostbyname, url)

  • unpluggd
    python libevent gevent
    I’m trying to install gevent on a fresh EC2 CentOS 5.3 64-bit system.Since the libevent version available in yum was too old for another package (beanstalkd) I compiled/installed libevent-1.4.13-stable manually using the following command:./configure –prefix=/usr && make && make installThis is the output from installing gevent:[gevent-0.12.2]# python setup.py build –libevent /usr/lib Using libevent 1.4.13-stable: libevent.so running build running build_py running build_ext Link

  • Danilo Bargen
    python concurrency gevent
    I’m doing a few dozen HTTP requests inside a Gevent pool.The goal is to retry a request once if it failed, but only once. Otherwise, it should throw an exception.How would I write gevent code with at pool that supports re-running HTTP requests once if they fail?Could this approach work?import requests import gevent from gevent.pool import Poolpool = Pool(10)def do_request(id):r = requests.get(‘http://example.com/%u’ % id)if not r.status_code == 200:raise RuntimeError(id)def spawn_greenlet(id, is

  • Mahmoud Abdelkader
    python exception gevent gunicorn python-requests
    First off, the versions:gevent – v0.13.7 gunicorn – v0.14.2 requests – 0.11.2We recently upgraded our servers that are running behind gunicorn to use the gevent asynchronous workers instead of just normal sync workers. Everything works great, but we’re now experiencing an issue when attempting to access a 3rd party service over http and I just have no idea how to track down what might be the issue.A brief stack trace looks like the following:File “/home/deploy/.virtualenvs/bapp/lib/python2.7/s