1359 Commits

Author SHA1 Message Date
John Ryding
6a3bd70d2b Add gthread and gaiohttp to settings docs 2016-03-26 01:39:29 +02:00
Randall Leeds
bab8ce016d Merge pull request #1218 from benoitc/gevent-remove-inner-exception-loop
[gevent] remove obsolete exception clauses in run
2016-03-25 13:22:33 -07:00
Randall Leeds
706eb98f33 Merge pull request #1222 from benoitc/fix/922-eventlet-graceful-close
[eventlet] close sockets at graceful shutdown
2016-03-25 13:19:21 -07:00
Randall Leeds
fd8b8e49c6 Merge pull request #1230 from benoitc/fix/922-thread-graceful-close
[thread] close sockets at graceful shutdown
2016-03-25 13:18:47 -07:00
Semyon Maryasin
03a944d668 Fixed traceback formatting 2016-03-24 00:37:12 +03:00
Randall Leeds
f104a0ef20 Merge pull request #1217 from benoitc/eventlet-async-quit
[eventlet] handle QUIT in a new coroutine
2016-03-22 10:37:13 -07:00
Benoit Chesneau
7be2b8d2ba Merge pull request #1231 from benoitc/fix/gh1177
prevent crash when reporting an error
2016-03-22 13:07:30 +01:00
benoitc
1ccebab763 prevent crash when reporting an error
Try to not crash when reporting an error. This changes makes sure we can log the uri and also handle SSL errors.

fix #1177
2016-03-22 11:32:01 +01:00
Randall Leeds
f2418a95e0 [thread] close sockets at graceful shutdown
The run loop has to change slightly to support graceful shutdown.
There is no way to interrupt a call to `futures.wait` so instead
the pattern, used by the async workers, is to sleep for only one
second at the most. The poll is extended to a one second timeout
to match.

Since threads are preemptively scheduled, it's possible that the
listener is closed when the request is actually handled. For this
reason it is necessary to slightly refactor the TConn class to store
the listening socket name. The name is checked once at the start of
the worker run loop.

Ref #922
2016-03-20 17:34:55 -07:00
Randall Leeds
5b32dde3ef Merge pull request #1228 from lyft/circular-ref-async-fd-leak-fix
Fix delayed socket close caused by circular ref from assigning traceback to local var
2016-03-19 18:18:28 -07:00
Paul Fisher
20d3a2d0c9 clean up sys.exc_info calls to drop circular refs 2016-03-19 17:27:58 -07:00
benoitc
6b34cdba71 bump to 19.5.0 2016-03-19 19:23:34 +01:00
benoitc
1e10a02e73 check if the header contains control characters
fix #1227
2016-03-19 19:16:59 +01:00
Randall Leeds
b6afc28528 Merge pull request #1221 from benoitc/fix/922-arbiter-close-on-shutdown
[arbiter] close sockets on shutdown
2016-03-13 16:59:02 -07:00
Randall Leeds
48d1e74d01 [eventlet] close sockets at graceful shutdown
Ref #922
2016-03-13 16:57:42 -07:00
Randall Leeds
39cecbc8e9 [arbiter] close sockets on shutdown
Close all the listeners when the arbiter shuts down. By doing so,
workers can close the socket at the beginning of a graceful shut
down thereby informing the operating system that the socket can
be cleaned up. With this change, graceful exits with such workers
will refuse new connections while draining, allowing load balancers
to respond more quickly and avoiding leaving connections dangling
in the listen backlog, unaccepted.

Ref #922
2016-03-13 16:47:23 -07:00
Randall Leeds
527dd7a1e6 Merge pull request #1219 from benoitc/fix/socket-destroy-recursion
fix infinite recursion when destroying sockets
2016-03-13 16:34:04 -07:00
Randall Leeds
d4e1abd84b Merge pull request #1220 from benoitc/fix/host-restart-uds
Fix/host restart uds
2016-03-13 16:28:52 -07:00
Randall Leeds
e46dda7e76 fix infinite recursion when destroying sockets
By having a `getattr` implementation that proxies to the `sock`
attribute, there is a risk of infinite recursion when the socket
attribute is absent. After closing the socket and destroying it,
the recursion can be prevented by setting the attribute to `None`.
2016-03-13 14:50:11 -07:00
Randall Leeds
1388232e38 [gevent] remove obsolete exception clauses in run
Since the changes from #1126, errors are not raised into the main
loop during a non-graceful shutdown. Therefore, these exception
clauses shouldn't be needed anymore.
2016-03-13 14:36:42 -07:00
Randall Leeds
c6387b3031 [eventlet] handle QUIT in a new coroutine
Just like in the gevent worker, a blocking call should only be executed
from within a coroutine. The AssertionError around the main loop of the
eventlet worker can be removed, since it was there to catch
the exception raised by the sleep.
2016-03-13 14:32:43 -07:00
Stuart Tettemer
4204acb280 update django doc url to 1.8 lts 2016-03-07 17:56:28 -08:00
bloodearnest
34b595e817 Always use the the user configured logger class.
Previously, configuring statsd_host would override the configured class
2016-02-19 13:09:58 +00:00
Simon Davy
f68a043c24 Allow configuring logger_class with statsd_host
Currently if you configure statsd_host, a configured logger_class will never be used.

I think this makes a user configured logger class always take priority.

(This is PoC change, I will come back and add tests/docs if it's worth pursuing)
2016-02-19 13:09:58 +00:00
Berker Peksag
51f49f4887 Remove unused import and pass True instead of 1
The logging module checks exc_info as

    if exc_info:
        # ...

so passing True would be more readable.
2016-02-12 09:20:55 +02:00
Kenneth Reitz
845545ace2 Merge branch 'master' into forwarded_allow_ips_env 2016-02-11 18:42:14 -05:00
Kenneth Reitz
e59f7ad000 style improvements 2016-02-11 18:35:11 -05:00
Kenneth Reitz
a669867099 $FORWARDED_ALLOW_IPS 2016-02-11 18:25:20 -05:00
bloodearnest
0acfb55d5f Let logging module handle traceback printing
Manually including the traceback in the log msg causes some issues when
interacting with log formats, and in one case was causing the traceback
to be printed twice.
2016-02-09 14:05:18 +00:00
Randall Leeds
d6a47e8aa2 Merge pull request #1193 from urbaniak/gaiohttp-logging
fix access logging in gaiohttp worker
2016-02-02 18:04:40 -08:00
Krzysztof Urbaniak
353508cd8a fix access logging in gaiohttp worker 2016-02-03 00:55:58 +01:00
William Pitcock
448bb0a94d use EnvironmentError instead of socket.error 2016-02-01 09:57:27 -05:00
Benoit Chesneau
db52b6e66b Merge pull request #1079 from darkrain42/empty-message-for-HEAD-replies
Ensure response to HEAD request won't have message body
2016-01-22 15:17:54 +01:00
Paul Fisher
4fc3fbec33 lock domain socket and remove on last arbiter exit 2016-01-20 11:05:38 -08:00
Semyon Maryasin
46da49fd5a Fixed log message for listener reloading
Fixes #1181
2016-01-09 15:01:27 +03:00
benoitc
6dcd7a6ada keep a consistent style 2016-01-05 01:10:38 +01:00
benoitc
68cd6c3b05 bump to 19.4.5 2016-01-05 01:06:42 +01:00
Hannes Uebelacker
2fe4ad72ca fix http.wsgi.Response.sendfile 2016-01-04 14:11:15 +01:00
benoitc
72ebf90574 it should be 19.4.4 2016-01-04 10:46:23 +01:00
benoitc
894978d171 bump to 19.4.3 2016-01-04 10:34:40 +01:00
benoitc
c42419dacb doc: be more descriptive in errorlog option
fix #1173
2016-01-04 10:22:40 +01:00
Paul Aurich
53329b19cc Ensure response to HEAD request won't have message body
Ensure that Gunicorn won't try to use chunked transfer-encoding for responses
to a HEAD request, so that `Response.close` will not write a terminating
chunk. Responses to a HEAD request MUST NOT have a message-body.

The application is still responsible for ensuring no message body is actually
generated in response to a HEAD request.
2016-01-03 18:25:07 -08:00
benoitc
5bc13be79e rename util.is_fileobject to util.has_fileno
be more descriptive
2015-12-31 15:32:08 +01:00
benoitc
d55ef38c8a reuse util.is_fileobject
is_fileobject usgae was removed due to the use of the `tell` method check.
This change remove this check wich allows us to completely test if
fileno() is usable. Also it handle most of the exceptions around created by
breaking changes across Python versions. Hopefully we are good now.

fix #1174
2015-12-31 14:50:48 +01:00
Benoit Chesneau
6439c3ba7a don't check if a file is writable using os.stat
Some systems edisable like SELINUX disable some flags so ignore the possible
error while chowning a log file. The error will be raised later anyway.

fix #1171
2015-12-29 15:01:23 +01:00
Benoit Chesneau
01cdd8b62a bump to 19.4.2
fix #1159
2015-12-29 01:32:53 +01:00
Randall Leeds
98c9e3b375 Catch sendfile failure from no file descriptor
If the filelike response object has no `fileno` attribute, then skip
trying to use sendfile rather than failing with an error.

Close #1160
2015-12-28 14:50:46 -08:00
Benoit Chesneau
9730978782 fix sendfile option validation
sendfile option don't set any default for now which makes the validation fail
(and then tests) since no boolean is given. For now just return when the value
is not set.
2015-12-28 20:39:45 +01:00
Benoit Chesneau
c805bd2960 check auth before trying to own a file
fix #1157
2015-12-28 13:00:44 +01:00
Benoit Chesneau
d199e76cea revert TCP__FASTOPEN change
on OSX socket.TCP_FASTOPEN is set but make the server enter in a loop while
trying to set the options which makes gunicorn unusable.

For now remove TCP_FASTOPEN option until we find a solution
2015-12-28 12:56:11 +01:00