Accepting request 358349 from home:aplanas:branches:devel:languages:python

- Add 0001_create_a_thread_to_reap_death_process.patch
  Fixes bsc#954591

- update to 0.11.3:
  - Added reloader_paths option to run_simple and other functions in
    werkzeug.serving. This allows the user to completely override the
    Python module watching of Werkzeug with custom paths.
  - Many custom cached properties of Werkzeug’s classes are now
    subclasses of Python’s property type (issue #616).
  - bind_to_environ now doesn’t differentiate between implicit and
    explicit default port numbers in HTTP_HOST (pull request #204).
  - BuildErrors are now more informative. They come with a complete
    sentence as error message, and also provide suggestions (pull
    request #691).
  - Fix a bug in the user agent parser where Safari’s build number
    instead of version would be extracted (pull request #703).
  - Fixed issue where RedisCache set_many was broken for twemproxy,
    which doesn’t support the default MULTI command (pull request
    #702).
  - mimetype parameters on request and response classes are now always
    converted to lowercase.
  - Changed cache so that cache never expires if timeout is 0. This
    also fixes an issue with redis setex (issue #550)
  - Werkzeug now assumes UTF-8 as filesystem encoding on Unix if
    Python detected it as ASCII.
  - New optional has method on caches.
  - Fixed various bugs in parse_options_header (pull request #643).
  - If the reloader is enabled the server will now open the socket in
    the parent process if this is possible. This means that when the
    reloader kicks in the connection from client will wait instead of

OBS-URL: https://build.opensuse.org/request/show/358349
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Werkzeug?expand=0&rev=16
This commit is contained in:
Dirk Mueller 2016-02-09 09:45:07 +00:00 committed by Git OBS Bridge
parent 2255701564
commit f07495d804
5 changed files with 120 additions and 5 deletions

View File

@ -0,0 +1,64 @@
From 676bc5fa4b6aa9d153c9805cdbad0ff0450bade6 Mon Sep 17 00:00:00 2001
From: Alberto Planas <aplanas@gmail.com>
Date: Wed, 3 Feb 2016 11:56:23 +0100
Subject: [PATCH] Create a thread to reap death process
ForkingWSGIServer use `SocketServer.ForkingMixIn` to implement a
multiprocess server. This class provides a workflow that collect
death process (process in Zombie status) before the
`process_request`. This means that this process itself will be
in Zombie status at the end of the request, that will be eventually
collected during the next `process_request`.
To minimize transient Zombie process, `ForkingWSGIServer` is
creating a daemon thread (via `threading.Timer`) to call the
collector every (by default) 5 seconds.
Fixes #810
---
werkzeug/serving.py | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/werkzeug/serving.py b/werkzeug/serving.py
index 15b6cd7..778df2d 100644
--- a/werkzeug/serving.py
+++ b/werkzeug/serving.py
@@ -41,6 +41,7 @@
import socket
import sys
import signal
+import threading
from ._compat import PY2
@@ -522,11 +523,29 @@ class ForkingWSGIServer(ForkingMixIn, BaseWSGIServer):
multiprocess = True
def __init__(self, host, port, app, processes=40, handler=None,
- passthrough_errors=False, ssl_context=None, fd=None):
+ passthrough_errors=False, ssl_context=None, fd=None,
+ frequency=5):
BaseWSGIServer.__init__(self, host, port, app, handler,
passthrough_errors, ssl_context, fd)
self.max_children = processes
+ if frequency:
+ self.frequency = frequency
+ self.setup_reap_children()
+
+ def setup_reap_children(self):
+ """Create a thread to collect death children."""
+ t = threading.Timer(self.frequency, self.reap_children)
+ # Set daemon mode to provide a clean termination of the thread
+ # when the system ends
+ t.daemon = True
+ t.start()
+
+ def reap_children(self):
+ """Reap or collect death children."""
+ self.collect_children()
+ self.setup_reap_children()
+
def make_server(host=None, port=None, app=None, threaded=False, processes=1,
request_handler=None, passthrough_errors=False,

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9d2771e4c89be127bc4bac056ab7ceaf0e0064c723d6b6e195739c3af4fd5c1d
size 1137282

3
Werkzeug-0.11.3.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eb5f700a9bfc96420b055635af9002d3662e43d80c3ffd31f224c25bc0d5f462
size 1152396

View File

@ -1,3 +1,51 @@
-------------------------------------------------------------------
Mon Feb 8 13:01:58 UTC 2016 - aplanas@suse.com
- Add 0001_create_a_thread_to_reap_death_process.patch
Fixes bsc#954591
-------------------------------------------------------------------
Mon Feb 8 12:35:28 UTC 2016 - aplanas@suse.com
- update to 0.11.3:
- Added reloader_paths option to run_simple and other functions in
werkzeug.serving. This allows the user to completely override the
Python module watching of Werkzeug with custom paths.
- Many custom cached properties of Werkzeugs classes are now
subclasses of Pythons property type (issue #616).
- bind_to_environ now doesnt differentiate between implicit and
explicit default port numbers in HTTP_HOST (pull request #204).
- BuildErrors are now more informative. They come with a complete
sentence as error message, and also provide suggestions (pull
request #691).
- Fix a bug in the user agent parser where Safaris build number
instead of version would be extracted (pull request #703).
- Fixed issue where RedisCache set_many was broken for twemproxy,
which doesnt support the default MULTI command (pull request
#702).
- mimetype parameters on request and response classes are now always
converted to lowercase.
- Changed cache so that cache never expires if timeout is 0. This
also fixes an issue with redis setex (issue #550)
- Werkzeug now assumes UTF-8 as filesystem encoding on Unix if
Python detected it as ASCII.
- New optional has method on caches.
- Fixed various bugs in parse_options_header (pull request #643).
- If the reloader is enabled the server will now open the socket in
the parent process if this is possible. This means that when the
reloader kicks in the connection from client will wait instead of
tearing down. This does not work on all Python versions.
- Implemented PIN based authentication for the debugger. This can
optionally be disabled but is discouraged. This change was
necessary as it has been discovered that too many people run the
debugger in production.
- Devserver no longer requires SSL module to be installed.
- Reloader: Correctly detect file changes made by moving temporary
files over the original, which is e.g. the case with PyCharm (pull
request #722).
- Fix bool behavior of werkzeug.datastructures.ETags under Python 3
(issue #744).
-------------------------------------------------------------------
Mon Jun 22 14:22:45 UTC 2015 - tbechtold@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package python-Werkzeug
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,13 +17,15 @@
Name: python-Werkzeug
Version: 0.10.4
Version: 0.11.3
Release: 0
Url: http://werkzeug.pocoo.org/
Summary: The Swiss Army knife of Python web development
License: BSD-3-Clause
Group: Development/Languages/Python
Source: http://pypi.python.org/packages/source/W/Werkzeug/Werkzeug-%{version}.tar.gz
# PATCH-FIX-UPSTREAM 0001_create_a_thread_to_reap_death_process.patch bsc#954591
Patch0: 0001_create_a_thread_to_reap_death_process.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python-Sphinx
BuildRequires: python-devel
@ -64,6 +66,7 @@ Documentation and examples for %{name}.
%setup -q -n Werkzeug-%{version}
sed -i "s/\r//" LICENSE # Fix wrong EOL-encoding
sed -i "1d" examples/manage-{i18nurls,simplewiki,shorty,couchy,cupoftee,webpylike,plnt,coolmagic}.py # Fix non-executable scripts
%patch0 -p1
%build
python setup.py build