78 Commits

Author SHA1 Message Date
Randall Leeds
54af01b1be Rename GeventResponse.response_length to sent
This makes it compatible with the duck typing of the response object
in the glogging request logger.
2014-12-19 09:54:37 -08:00
Collin Anderson
0d3045bb41 cleaned some code 2014-09-10 20:34:22 -04:00
Berker Peksag
829e8d32d4 Remove __future__.with_statement imports.
Gunicorn requires Python 2.6 or newer now:

http://docs.gunicorn.org/en/latest/install.html#requirements
2014-05-15 00:34:02 +03:00
WooParadog
9eb589576d Stop all servers 2014-05-14 17:45:30 +08:00
Randall Leeds
56b5f4038f set wsgi.multithread to True for async workers
Also simplifies the environment handling in the gevent_pywsgi
server so that it also has this key. An added side effect is
that the gunicorn FileWrapper gets set for the gevent_pywsgi
worker, too.

Fixes #486
2014-01-01 16:42:56 +01:00
Dariusz Suchojad
5fb61cb841 Added support for more options to ssl.wrap_socket 2013-12-26 14:21:38 +01:00
Anil V
0daf25e816 Reinit Hub when using old version of gevent.
fix #654
2013-12-11 08:59:24 +01:00
David Wolever
3be526abed Fix "global name 'hub' is not defined" 2013-11-25 17:34:38 -05:00
benoitc
4ae65eeabf fix support for current but old stable gevent release 2013-11-05 08:07:57 +01:00
Dan Sully
e9416b1177 Include subprocess in the gevent monkey patching to ensure consistent behavior between gevent 1.0b3 and 1.0rc3 2013-11-04 15:18:34 +01:00
benoitc
9a83d719b2 fix gevent worker 2013-11-04 14:43:40 +01:00
benoitc
f2920bfcda monkey patch in the worker
this change move the monkey patching from the aribiter to the worker so we make sure the supervision won't be altered.

fix #478
2013-11-04 14:26:05 +01:00
benoitc
25094605cf monkeypatch wsgi.sendfile for gevent
make sendfile usage non blocking with gevent
2013-08-27 18:18:35 +02:00
Randall Leeds
63600aa6b3 [ggevent] Don't die when logging requests
Some requests, such as websocket requests, may not have headers.
2013-08-06 02:56:48 -07:00
Randall Leeds
68b48b9694 Forward-compatibility for gevent graceful shutdown
This commit closes the loop on fd6c712.

Aforementioned commit fixed observable problems in my testing with
gevent 1.0 release candidates but the explanation given at the time
was curiously bogus. It came from a misreading of pools and servers
as used in the ggevent worker.

With this change, both versions of gevent should support graceful
and non-graceful shutdown.
2013-08-06 02:56:47 -07:00
Randall Leeds
33f7c96db6 [ggevent] Stop quickly and cleanly on ppid change
This change should improve interaction with reloaders and ensure that
ports are not stuck open if the arbiter gets a hard kill signal or
otherwise exits during any graceful or non-graceful shutdown.
2013-08-06 02:56:47 -07:00
Konstantin Enchant
b6d72504eb Fixed stop all servers (gevent worker). 2013-02-25 14:25:08 +04:00
Adnane Belmadiaf
20cd49595a PEP8 fixes 2012-12-24 09:53:03 +01:00
benoitc
1198cc2723 handle ssl connections.
gunicorn is now supporting ssl connections:

    $ gunicorn -w3 --certfile=server.crt --keyfile=server.key test:app

works with all supported workers
2012-12-14 10:22:05 +01:00
benoitc
b7b51adf13 allows gunicorn to bind to multiple address
Allows gunicorn to listen on different interface. It can be either ipv6,
unix or ipv4 sockets.

Ex:

    gunicorn -w3 -b 127.0.0.1:8001 -b 127.0.0.1:8000 -b [::1]:8000 test:app

fix #444
2012-12-14 10:18:39 +01:00
Konstantin Kapustin
b9bb3453c2 Fix graceful shutdown for gevent.
server.stop() are blocking worker and which is then may be killed by Arbiter.murder_workers() with timeout (not graceful_timeout). It's issues when graceful_timeout > timeout.
2012-07-25 18:18:53 +04:00
benoitc
cdd3e1dc2b check parents if we are in the worker. fix #348 2012-06-27 08:08:57 +02:00
benoitc
12a0e55bcf Revert "fix issue #348 ."
This reverts commit da637dfd13b520fc190b86967dfecc06bf97a2b4.
2012-06-19 10:31:06 +02:00
benoitc
e78d19019d apparently gevent doesn4t import gevent.core now 2012-06-06 09:59:21 +02:00
benoitc
118c571898 fix issue #348 .
Rather than testing the parent pd, test if the parent pid is still
alive. Only use it in gevent for now.
2012-06-04 21:17:11 +02:00
benoitc
188fa3e109 add the graceful timeout option. close #352
This change add gtraceful timeout option. This timeout is different than
the worker timeout and can be extended to handled a longer delay before
closing a running connection.

Patch based on the one given by @sirkonst with some edit + support of
the eventlet worker.
2012-06-01 09:07:43 +02:00
Randall Leeds
dd948d6f46 better support for new and old gevent dns
Thanks @denik. Fixes #336.
2012-04-22 20:11:34 -07:00
Bobby Beckmann
6630c5e3e1 Makes gunicorn work with gevent 1.0b2 2012-04-11 15:30:35 -05:00
benoitc
d6012fa84b fix gevent_pywsgi worker. close #314
access_log arity has changed in 0.14.0. Apply this change to the pywsgi
worker as well.
2012-03-16 07:18:30 +01:00
benoitc
1319543448 use the cached app. 2012-03-01 08:02:15 +01:00
benoitc
c7a0af5d3a make the django monkey patching less intrusive.
only patch in the `run_gunicorn` command.
2012-02-21 16:48:43 +01:00
benoitc
fa341c6531 pyflakes pass. 2012-02-21 14:53:17 +01:00
benoitc
161c8c03cb monkey patch django. close #293 .
This patch make sure that we use real threads to get the ident which is
going to happen if we are using gevent or eventlet.
2012-02-21 14:24:55 +01:00
benoitc
b2c83b2bc3 fix whitespaces. 2012-02-21 14:23:52 +01:00
benoitc
860895c03d fix typo 2011-09-19 23:18:18 +02:00
Randall Leeds
612a895b15 fix up ugly attribute use in ggevent 2011-09-19 13:41:23 -07:00
Randall Leeds
d6915942f7 factor out duplicate gevent-based worker code 2011-09-18 03:50:13 -07:00
Randall Leeds
55de904e9d add access logging for gevent_* workers 2011-09-18 03:50:13 -07:00
WoLpH
179b87639c removed python string formatting from logging to enable log message grouping 2011-05-11 23:11:36 +02:00
denis
2ab4bbf46f fix compatibility with gevent 0.14 dev version
Move "import gevent.wsgi" into a separate module, which is not
imported if pywsgi worker is requested. (The gevent.wsgi currently
not provided by gevent trunk but pywsgi works fine.)
2011-05-11 23:11:03 +02:00
benoitc
ba89a400dc we don't do anythiung in __init__, remove these lines. 2011-03-03 10:36:14 +01:00
benoitc
16fd5d3c20 remove some useless code. pyflakes my friend. 2010-12-22 19:52:34 +01:00
Paul J. Davis
07f0c0f21d Fixes signal reaction times.
After messing around trying to make this more elegant we've decided to
just slap a 1s poll to the thing which seems to fix various bugs in the
async event handling.
2010-12-20 08:15:45 -05:00
benoitc
2e39db265c rather than sleeping the timeout, just test if time is elapsed, then
notify. Speed graceful reload and exit.
2010-12-12 22:57:50 +01:00
benoitc
a8e34ac16c send appropriate error status on http parsing. Fix issue #132. 2010-12-12 14:16:31 +01:00
benoitc
95a4af2a9c display the right error when a worker can't be used. 2010-10-28 06:13:57 +02:00
benoitc
939b459c38 don't notify so much the arbiter. spotted by @davisp & @prencher . tests are ok. 2010-10-28 06:13:45 +02:00
benoitc
7715199b48 it's better to test when you use the right code to do it. We had a
blocking operation django example (we read a file already on the fs and
recreate another which blocked async schedulers).

While I'm here ease the code of eventlet worker. Just use the convenient
eventlet.serve function which already manage what we do and revert sopme
useless changes in body and header parsing.
2010-09-02 14:55:56 +02:00
benoitc
8d089f95f9 workaround to prevent segfault with current gevent on osx. Disable
kqueue.
2010-09-01 11:30:20 +02:00
benoitc
5c498b6a89 do the same for others. 2010-09-01 10:30:30 +02:00