107 Commits

Author SHA1 Message Date
benoitc
418f140445 remove file locking
This changes improve the binary upgrade behaviour using USR2:

- only one binary upgrade can happen at a time: the old arbiter needs to be
  killed to promote the new arbiter.
- if a new arbiter is already spawned, until one is killed USR2 has no action
- if a new arbiter has been spawned, the unix socket won't be unlinked
- until the old arbiter have been killed the newly created pidfile has the name
  <pidfile>.2 and the name Master.2 .

Note: there is no dialog between both arbiters to handle this features.
Instead they will supervise each others until one is killed. So isolation is
still guaranted.

fix #1267
2016-05-20 15:42:55 +02:00
benoitc
8a6748ee65 fix unix socket locking
This change add proper file locking to gunicorn. By default "gunicorn.lock" is created in the temporary directory when a unix socket is bound.  In case someone want to fix the lock file path or use multiple gunicorn instance the "--lock-file" setting can be used to set the path of this file.

fix #1259
2016-05-14 22:03:40 +02:00
Eugene Obukhov
a04b5f0975 Add tests for reader classes (#1241)
* Fix FakeSocket.recv method

* Add tests for Unreader and its subclasses

* Add tests for EOFReader and LengthReader
2016-04-15 00:49:00 +03:00
Berker Peksag
31fd844333 Fix test_http on Python 2 2016-03-20 08:16:05 +02:00
Berker Peksag
b17f1bc305 Fix typo in test name 2016-03-20 07:52:59 +02:00
Berker Peksag
33924a8649 Use more pytest.raises() in test_http.py
Signed-off-by: Berker Peksag <berker.peksag@gmail.com>
2016-03-20 07:52:13 +02: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
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
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
452cd550d2 add tests for arbiter unix socket locking 2016-03-13 15:56:22 -07: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
Benoit Chesneau
3fdc113d81 fix gaiohttp test
fix #1164
2015-12-28 20:22:03 +01:00
benoitc
09e0d4c7fc encode fix test 2015-11-25 14:11:54 +01:00
y.umezaki
7dd8a53c8c Add accesslog params
Fix KeyError

Update access logger tests

Update settings.rst docs
2015-10-22 02:28:35 +09:00
Jochen Wersdörfer
338721ac56 encode http headers as latin1 RFC 2616 2015-08-29 11:16:58 +02:00
Slava Shklyaev
0d86a9094d Improve markup of settings.rst 2015-07-15 04:10:15 +03:00
Randall Leeds
ec84c80c75 On pypy3 IOError is not OSError 2015-07-13 14:32:01 -07:00
Berker Peksag
ec3664dd30 Merge pull request #1068 from slava-sh/836-add-config-type-prefix
Prefix config file with its type

Fixes #836
2015-07-09 10:59:29 +03:00
Berker Peksag
da37bcfebe Adda test case for #1069. 2015-07-08 12:16:09 +03:00
Slava Shklyaev
531133615e Prefix config file with its type 2015-07-08 09:21:32 +03:00
Berker Peksag
31ea81f19b Rename statsd test file to test_statsd.py. 2015-07-03 07:51:04 +03:00
Berker Peksag
9475e2625e Rename test files. 2015-07-03 07:46:22 +03:00
Berker Peksag
295ca8ccaf Use six.StringIO in test_statsd.py. 2015-07-03 07:43:44 +03:00
Berker Peksag
7fff5afa39 Minor cosmetic fixes. 2015-07-03 07:43:22 +03:00
Berker Peksag
436c9872a2 Use a pytest fixture in test_default_config_file. 2015-07-03 07:42:56 +03:00
Berker Peksag
a0f05555aa Silence a py.test warning. 2015-07-03 07:41:53 +03:00
Berker Peksag
2af9468940 Parametrize valid request tests. 2015-07-03 07:41:24 +03:00
Berker Peksag
882e00f6b5 Use types.SimpleNamespace where appropriate. 2015-07-03 07:40:32 +03:00
Berker Peksag
337900037f Convert tests to use py.test assertions.
Closes #950
2015-07-03 07:38:36 +03:00
Berker Peksag
945d2ecfc3 Parametrize invalid request tests. 2015-05-09 21:49:10 +03:00
Randall Leeds
72c8be56fc Add test for #1023 2015-05-09 20:46:31 +03:00
Thomas Orozco
410bcfa6e1 Fix statsd logging to work on Python 3
Bytes must be passed to socket.send.

Update tests to ensure an actual socket is used, so that errors like
this can be caught in unit tests in the future.
2015-04-30 14:07:03 +02:00
Berker Peksag
7ce90373a8 Remove unused imports. 2014-12-01 07:00:02 +02:00
Berker Peksag
4713ef7f37 Pass a 'sent' parameter to Mock(). 2014-11-24 23:07:46 +02:00
Sungho Ryu
53a4ea556f Added missing import for platform in tests/support.py for os x. 2014-11-24 14:58:31 +01:00
Berker Peksag
bf3ef8f389 Add selectors module to gunicorn codebase.
Closes #886.
2014-10-16 15:44:10 +03:00
Benoit Chesneau
27c75d5d75 Merge pull request #887 from jssjr/jssjr/statsd-prefix
Allow for statsd metrics to be prefixed
2014-10-03 08:57:53 +02:00
Collin Anderson
f2ba62bc10 six 1.8.0 and gunicorn._compat
closes #904 and #905
2014-10-02 17:00:03 -04:00
Scott Sanders
c9c543dc82 Update tests to demonstrate trailing . handling 2014-09-16 08:34:38 -04:00
Scott Sanders
88bc188407 Add tests for statsd prefix 2014-09-12 14:58:03 -04:00
Collin Anderson
03fbe9429d clean whitespace 2014-09-10 09:52:12 -04:00
benoitc
f80ddf368c fix tests 2014-08-16 12:26:04 +02:00
Randall Leeds
42ff88bbbd Merge pull request #838 from mgood/statsd-timing
Send statsd timing metrics in milliseconds
2014-08-05 00:26:40 -07:00
Matt Good
59bf9b5867 Fix statsd test for millisecond times 2014-08-03 14:39:34 -07:00
Alexis Le-Quoc
bc2e132bce Rework logging to allow for empty log message while pushing metrics 2014-08-03 17:15:13 -04:00
Andrew Svetlov
2b2725dddb Support UNIX sockets in gaiohttp worker 2014-07-23 07:33:18 +03:00
Benoit Chesneau
ceda9c597c Merge pull request #748 from alq666/statsd-logger
gunicorn instrumentation via statsD and a new logger class
2014-06-28 16:45:54 +02:00
Thomas Grainger
2bde8eb103 Support loading config from module 2014-06-20 09:20:37 +01:00
Alexis Le-Quoc
05051aa8b2 Simpler statsd integration
No need to specify a logger class.
--statsd-to is enough to trigger the Statsd logger automatically
2014-06-18 21:33:04 -04:00