We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Cleanup errors are silenced by gunicorn worke
GunicornWebWorker explicitly suppresses all exceptions when calling `_run` method. Thus any exception in on_cleanup handler passes silently and farther handlers of the signal (if any) are not called. 

There is a plenty of places in aiohttp probably with the same problem:
```
$ grep --include='*.py' -nF 'with suppress(Exception)' -R aiohttp
aiohttp/client_proto.py:70:            with suppress(Exception):
aiohttp/connector.py:139:            with suppress(Exception):
aiohttp/helpers.py:464:        with suppress(Exception):
aiohttp/helpers.py:517:            with suppress(Exception):
aiohttp/web_protocol.py:518:                with suppress(Exception):
aiohttp/worker.py:71:        with suppress(Exception):  # ignore all finalization problems
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `aiohttp/worker.py`
Content:
```
1 """Async gunicorn worker for aiohttp.web"""
2 
3 import asyncio
4 import os
5 import re
6 import signal
7 import sys
8 from contextlib import suppress
9 from types import FrameType
10 from typing import Any, Optional  # noqa
11 
12 from gunicorn.config import AccessLogFormat as GunicornAccessLogFormat
13 from gunicorn.workers import base
14 
15 from aiohttp import web
16 
17 from .helpers import set_result
18 from .web_log import AccessLogger
19 
20 
21 try:
22     import ssl
23     SSLContext = ssl.SSLContext  # noqa
24 except ImportError:  # pragma: no cover
25     ssl = None  # type: ignore
26     SSLContext = object  # type: ignore
27 
28 
29 __all__ = ('GunicornWebWorker',
30            'GunicornUVLoopWebWorker',
31            'GunicornTokioWebWorker')
32 
33 
34 class GunicornWebWorker(base.Worker):
35 
36     DEFAULT_AIOHTTP_LOG_FORMAT = AccessLogger.LOG_FORMAT
37     DEFAULT_GUNICORN_LOG_FORMAT = GunicornAccessLogFormat.default
38 
39     def __init__(self, *args: Any, **kw: Any) -> None:  # pragma: no cover
40         super().__init__(*args, **kw)
41 
42         self._runner = None  # type: Optional[web.AppRunner]
43         self._task = None  # type: Optional[asyncio.Task[None]]
44         self.exit_code = 0
45         self._notify_waiter = None  # type: Optional[asyncio.Future[bool]]
46 
47     def init_process(self) -> None:
48         # create new event_loop after fork
49         asyncio.get_event_loop().close()
50 
51         self.loop = asyncio.new_event_loop()
52         asyncio.set_event_loop(self.loop)
53 
54         super().init_process()
55 
56     def run(self) -> None:
57         access_log = self.log.access_log if self.cfg.accesslog else None
58         params = dict(
59             logger=self.log,
60             keepalive_timeout=self.cfg.keepalive,
61             access_log=access_log,
62             access_log_format=self._get_valid_log_format(
63                 self.cfg.access_log_format))
64         if asyncio.iscoroutinefunction(self.wsgi):  # type: ignore
65             self.wsgi = self.loop.run_until_complete(
66                 self.wsgi())  # type: ignore
67         self._runner = web.AppRunner(self.wsgi, **params)
68         self.loop.run_until_complete(self._runner.setup())
69         self._task = self.loop.create_task(self._run())
70 
71         with suppress(Exception):  # ignore all finalization problems
72             self.loop.run_until_complete(self._task)
73         if sys.version_info >= (3, 6):
74             if hasattr(self.loop, 'shutdown_asyncgens'):
75                 self.loop.run_until_complete(self.loop.shutdown_asyncgens())
76         self.loop.close()
77 
78         sys.exit(self.exit_code)
79 
80     async def _run(self) -> None:
81         ctx = self._create_ssl_context(self.cfg) if self.cfg.is_ssl else None
82 
83         runner = self._runner
84         assert runner is not None
85         server = runner.server
86         assert server is not None
87         for sock in self.sockets:
88             site = web.SockSite(
89                 runner, sock, ssl_context=ctx,
90                 shutdown_timeout=self.cfg.graceful_timeout / 100 * 95)
91             await site.start()
92 
93         # If our parent changed then we shut down.
94         pid = os.getpid()
95         try:
96             while self.alive:  # type: ignore
97                 self.notify()
98 
99                 cnt = server.requests_count
100                 if self.cfg.max_requests and cnt > self.cfg.max_requests:
101                     self.alive = False
102                     self.log.info("Max requests, shutting down: %s", self)
103 
104                 elif pid == os.getpid() and self.ppid != os.getppid():
105                     self.alive = False
106                     self.log.info("Parent changed, shutting down: %s", self)
107                 else:
108                     await self._wait_next_notify()
109         except BaseException:
110             pass
111 
112         await runner.cleanup()
113 
114     def _wait_next_notify(self) -> 'asyncio.Future[bool]':
115         self._notify_waiter_done()
116 
117         loop = self.loop
118         assert loop is not None
119         self._notify_waiter = waiter = loop.create_future()
120         self.loop.call_later(1.0, self._notify_waiter_done, waiter)
121 
122         return waiter
123 
124     def _notify_waiter_done(self, waiter: 'asyncio.Future[bool]'=None) -> None:
125         if waiter is None:
126             waiter = self._notify_waiter
127         if waiter is not None:
128             set_result(waiter, True)
129 
130         if waiter is self._notify_waiter:
131             self._notify_waiter = None
132 
133     def init_signals(self) -> None:
134         # Set up signals through the event loop API.
135 
136         self.loop.add_signal_handler(signal.SIGQUIT, self.handle_quit,
137                                      signal.SIGQUIT, None)
138 
139         self.loop.add_signal_handler(signal.SIGTERM, self.handle_exit,
140                                      signal.SIGTERM, None)
141 
142         self.loop.add_signal_handler(signal.SIGINT, self.handle_quit,
143                                      signal.SIGINT, None)
144 
145         self.loop.add_signal_handler(signal.SIGWINCH, self.handle_winch,
146                                      signal.SIGWINCH, None)
147 
148         self.loop.add_signal_handler(signal.SIGUSR1, self.handle_usr1,
149                                      signal.SIGUSR1, None)
150 
151         self.loop.add_signal_handler(signal.SIGABRT, self.handle_abort,
152                                      signal.SIGABRT, None)
153 
154         # Don't let SIGTERM and SIGUSR1 disturb active requests
155         # by interrupting system calls
156         signal.siginterrupt(signal.SIGTERM, False)
157         signal.siginterrupt(signal.SIGUSR1, False)
158 
159     def handle_quit(self, sig: int, frame: FrameType) -> None:
160         self.alive = False
161 
162         # worker_int callback
163         self.cfg.worker_int(self)
164 
165         # wakeup closing process
166         self._notify_waiter_done()
167 
168     def handle_abort(self, sig: int, frame: FrameType) -> None:
169         self.alive = False
170         self.exit_code = 1
171         self.cfg.worker_abort(self)
172         sys.exit(1)
173 
174     @staticmethod
175     def _create_ssl_context(cfg: Any) -> 'SSLContext':
176         """ Creates SSLContext instance for usage in asyncio.create_server.
177 
178         See ssl.SSLSocket.__init__ for more details.
179         """
180         if ssl is None:  # pragma: no cover
181             raise RuntimeError('SSL is not supported.')
182 
183         ctx = ssl.SSLContext(cfg.ssl_version)
184         ctx.load_cert_chain(cfg.certfile, cfg.keyfile)
185         ctx.verify_mode = cfg.cert_reqs
186         if cfg.ca_certs:
187             ctx.load_verify_locations(cfg.ca_certs)
188         if cfg.ciphers:
189             ctx.set_ciphers(cfg.ciphers)
190         return ctx
191 
192     def _get_valid_log_format(self, source_format: str) -> str:
193         if source_format == self.DEFAULT_GUNICORN_LOG_FORMAT:
194             return self.DEFAULT_AIOHTTP_LOG_FORMAT
195         elif re.search(r'%\([^\)]+\)', source_format):
196             raise ValueError(
197                 "Gunicorn's style options in form of `%(name)s` are not "
198                 "supported for the log formatting. Please use aiohttp's "
199                 "format specification to configure access log formatting: "
200                 "http://docs.aiohttp.org/en/stable/logging.html"
201                 "#format-specification"
202             )
203         else:
204             return source_format
205 
206 
207 class GunicornUVLoopWebWorker(GunicornWebWorker):
208 
209     def init_process(self) -> None:
210         import uvloop
211 
212         # Close any existing event loop before setting a
213         # new policy.
214         asyncio.get_event_loop().close()
215 
216         # Setup uvloop policy, so that every
217         # asyncio.get_event_loop() will create an instance
218         # of uvloop event loop.
219         asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
220 
221         super().init_process()
222 
223 
224 class GunicornTokioWebWorker(GunicornWebWorker):
225 
226     def init_process(self) -> None:  # pragma: no cover
227         import tokio
228 
229         # Close any existing event loop before setting a
230         # new policy.
231         asyncio.get_event_loop().close()
232 
233         # Setup tokio policy, so that every
234         # asyncio.get_event_loop() will create an instance
235         # of tokio event loop.
236         asyncio.set_event_loop_policy(tokio.EventLoopPolicy())
237 
238         super().init_process()
239
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/aiohttp/worker.py b/aiohttp/worker.py
--- a/aiohttp/worker.py
+++ b/aiohttp/worker.py
@@ -5,7 +5,6 @@
 import re
 import signal
 import sys
-from contextlib import suppress
 from types import FrameType
 from typing import Any, Optional  # noqa
 
@@ -68,8 +67,10 @@
         self.loop.run_until_complete(self._runner.setup())
         self._task = self.loop.create_task(self._run())
 
-        with suppress(Exception):  # ignore all finalization problems
+        try:  # ignore all finalization problems
             self.loop.run_until_complete(self._task)
+        except Exception as error:
+            self.log.exception(error)
         if sys.version_info >= (3, 6):
             if hasattr(self.loop, 'shutdown_asyncgens'):
                 self.loop.run_until_complete(self.loop.shutdown_asyncgens())

{"golden_diff": "diff --git a/aiohttp/worker.py b/aiohttp/worker.py\n--- a/aiohttp/worker.py\n+++ b/aiohttp/worker.py\n@@ -5,7 +5,6 @@\n import re\n import signal\n import sys\n-from contextlib import suppress\n from types import FrameType\n from typing import Any, Optional  # noqa\n \n@@ -68,8 +67,10 @@\n         self.loop.run_until_complete(self._runner.setup())\n         self._task = self.loop.create_task(self._run())\n \n-        with suppress(Exception):  # ignore all finalization problems\n+        try:  # ignore all finalization problems\n             self.loop.run_until_complete(self._task)\n+        except Exception as error:\n+            self.log.exception(error)\n         if sys.version_info >= (3, 6):\n             if hasattr(self.loop, 'shutdown_asyncgens'):\n                 self.loop.run_until_complete(self.loop.shutdown_asyncgens())\n", "issue": "Cleanup errors are silenced by gunicorn worke\nGunicornWebWorker explicitly suppresses all exceptions when calling `_run` method. Thus any exception in on_cleanup handler passes silently and farther handlers of the signal (if any) are not called. \r\n\r\nThere is a plenty of places in aiohttp probably with the same problem:\r\n```\r\n$ grep --include='*.py' -nF 'with suppress(Exception)' -R aiohttp\r\naiohttp/client_proto.py:70:            with suppress(Exception):\r\naiohttp/connector.py:139:            with suppress(Exception):\r\naiohttp/helpers.py:464:        with suppress(Exception):\r\naiohttp/helpers.py:517:            with suppress(Exception):\r\naiohttp/web_protocol.py:518:                with suppress(Exception):\r\naiohttp/worker.py:71:        with suppress(Exception):  # ignore all finalization problems\r\n```\n", "before_files": [{"content": "\"\"\"Async gunicorn worker for aiohttp.web\"\"\"\n\nimport asyncio\nimport os\nimport re\nimport signal\nimport sys\nfrom contextlib import suppress\nfrom types import FrameType\nfrom typing import Any, Optional  # noqa\n\nfrom gunicorn.config import AccessLogFormat as GunicornAccessLogFormat\nfrom gunicorn.workers import base\n\nfrom aiohttp import web\n\nfrom .helpers import set_result\nfrom .web_log import AccessLogger\n\n\ntry:\n    import ssl\n    SSLContext = ssl.SSLContext  # noqa\nexcept ImportError:  # pragma: no cover\n    ssl = None  # type: ignore\n    SSLContext = object  # type: ignore\n\n\n__all__ = ('GunicornWebWorker',\n           'GunicornUVLoopWebWorker',\n           'GunicornTokioWebWorker')\n\n\nclass GunicornWebWorker(base.Worker):\n\n    DEFAULT_AIOHTTP_LOG_FORMAT = AccessLogger.LOG_FORMAT\n    DEFAULT_GUNICORN_LOG_FORMAT = GunicornAccessLogFormat.default\n\n    def __init__(self, *args: Any, **kw: Any) -> None:  # pragma: no cover\n        super().__init__(*args, **kw)\n\n        self._runner = None  # type: Optional[web.AppRunner]\n        self._task = None  # type: Optional[asyncio.Task[None]]\n        self.exit_code = 0\n        self._notify_waiter = None  # type: Optional[asyncio.Future[bool]]\n\n    def init_process(self) -> None:\n        # create new event_loop after fork\n        asyncio.get_event_loop().close()\n\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(self.loop)\n\n        super().init_process()\n\n    def run(self) -> None:\n        access_log = self.log.access_log if self.cfg.accesslog else None\n        params = dict(\n            logger=self.log,\n            keepalive_timeout=self.cfg.keepalive,\n            access_log=access_log,\n            access_log_format=self._get_valid_log_format(\n                self.cfg.access_log_format))\n        if asyncio.iscoroutinefunction(self.wsgi):  # type: ignore\n            self.wsgi = self.loop.run_until_complete(\n                self.wsgi())  # type: ignore\n        self._runner = web.AppRunner(self.wsgi, **params)\n        self.loop.run_until_complete(self._runner.setup())\n        self._task = self.loop.create_task(self._run())\n\n        with suppress(Exception):  # ignore all finalization problems\n            self.loop.run_until_complete(self._task)\n        if sys.version_info >= (3, 6):\n            if hasattr(self.loop, 'shutdown_asyncgens'):\n                self.loop.run_until_complete(self.loop.shutdown_asyncgens())\n        self.loop.close()\n\n        sys.exit(self.exit_code)\n\n    async def _run(self) -> None:\n        ctx = self._create_ssl_context(self.cfg) if self.cfg.is_ssl else None\n\n        runner = self._runner\n        assert runner is not None\n        server = runner.server\n        assert server is not None\n        for sock in self.sockets:\n            site = web.SockSite(\n                runner, sock, ssl_context=ctx,\n                shutdown_timeout=self.cfg.graceful_timeout / 100 * 95)\n            await site.start()\n\n        # If our parent changed then we shut down.\n        pid = os.getpid()\n        try:\n            while self.alive:  # type: ignore\n                self.notify()\n\n                cnt = server.requests_count\n                if self.cfg.max_requests and cnt > self.cfg.max_requests:\n                    self.alive = False\n                    self.log.info(\"Max requests, shutting down: %s\", self)\n\n                elif pid == os.getpid() and self.ppid != os.getppid():\n                    self.alive = False\n                    self.log.info(\"Parent changed, shutting down: %s\", self)\n                else:\n                    await self._wait_next_notify()\n        except BaseException:\n            pass\n\n        await runner.cleanup()\n\n    def _wait_next_notify(self) -> 'asyncio.Future[bool]':\n        self._notify_waiter_done()\n\n        loop = self.loop\n        assert loop is not None\n        self._notify_waiter = waiter = loop.create_future()\n        self.loop.call_later(1.0, self._notify_waiter_done, waiter)\n\n        return waiter\n\n    def _notify_waiter_done(self, waiter: 'asyncio.Future[bool]'=None) -> None:\n        if waiter is None:\n            waiter = self._notify_waiter\n        if waiter is not None:\n            set_result(waiter, True)\n\n        if waiter is self._notify_waiter:\n            self._notify_waiter = None\n\n    def init_signals(self) -> None:\n        # Set up signals through the event loop API.\n\n        self.loop.add_signal_handler(signal.SIGQUIT, self.handle_quit,\n                                     signal.SIGQUIT, None)\n\n        self.loop.add_signal_handler(signal.SIGTERM, self.handle_exit,\n                                     signal.SIGTERM, None)\n\n        self.loop.add_signal_handler(signal.SIGINT, self.handle_quit,\n                                     signal.SIGINT, None)\n\n        self.loop.add_signal_handler(signal.SIGWINCH, self.handle_winch,\n                                     signal.SIGWINCH, None)\n\n        self.loop.add_signal_handler(signal.SIGUSR1, self.handle_usr1,\n                                     signal.SIGUSR1, None)\n\n        self.loop.add_signal_handler(signal.SIGABRT, self.handle_abort,\n                                     signal.SIGABRT, None)\n\n        # Don't let SIGTERM and SIGUSR1 disturb active requests\n        # by interrupting system calls\n        signal.siginterrupt(signal.SIGTERM, False)\n        signal.siginterrupt(signal.SIGUSR1, False)\n\n    def handle_quit(self, sig: int, frame: FrameType) -> None:\n        self.alive = False\n\n        # worker_int callback\n        self.cfg.worker_int(self)\n\n        # wakeup closing process\n        self._notify_waiter_done()\n\n    def handle_abort(self, sig: int, frame: FrameType) -> None:\n        self.alive = False\n        self.exit_code = 1\n        self.cfg.worker_abort(self)\n        sys.exit(1)\n\n    @staticmethod\n    def _create_ssl_context(cfg: Any) -> 'SSLContext':\n        \"\"\" Creates SSLContext instance for usage in asyncio.create_server.\n\n        See ssl.SSLSocket.__init__ for more details.\n        \"\"\"\n        if ssl is None:  # pragma: no cover\n            raise RuntimeError('SSL is not supported.')\n\n        ctx = ssl.SSLContext(cfg.ssl_version)\n        ctx.load_cert_chain(cfg.certfile, cfg.keyfile)\n        ctx.verify_mode = cfg.cert_reqs\n        if cfg.ca_certs:\n            ctx.load_verify_locations(cfg.ca_certs)\n        if cfg.ciphers:\n            ctx.set_ciphers(cfg.ciphers)\n        return ctx\n\n    def _get_valid_log_format(self, source_format: str) -> str:\n        if source_format == self.DEFAULT_GUNICORN_LOG_FORMAT:\n            return self.DEFAULT_AIOHTTP_LOG_FORMAT\n        elif re.search(r'%\\([^\\)]+\\)', source_format):\n            raise ValueError(\n                \"Gunicorn's style options in form of `%(name)s` are not \"\n                \"supported for the log formatting. Please use aiohttp's \"\n                \"format specification to configure access log formatting: \"\n                \"http://docs.aiohttp.org/en/stable/logging.html\"\n                \"#format-specification\"\n            )\n        else:\n            return source_format\n\n\nclass GunicornUVLoopWebWorker(GunicornWebWorker):\n\n    def init_process(self) -> None:\n        import uvloop\n\n        # Close any existing event loop before setting a\n        # new policy.\n        asyncio.get_event_loop().close()\n\n        # Setup uvloop policy, so that every\n        # asyncio.get_event_loop() will create an instance\n        # of uvloop event loop.\n        asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())\n\n        super().init_process()\n\n\nclass GunicornTokioWebWorker(GunicornWebWorker):\n\n    def init_process(self) -> None:  # pragma: no cover\n        import tokio\n\n        # Close any existing event loop before setting a\n        # new policy.\n        asyncio.get_event_loop().close()\n\n        # Setup tokio policy, so that every\n        # asyncio.get_event_loop() will create an instance\n        # of tokio event loop.\n        asyncio.set_event_loop_policy(tokio.EventLoopPolicy())\n\n        super().init_process()\n", "path": "aiohttp/worker.py"}], "after_files": [{"content": "\"\"\"Async gunicorn worker for aiohttp.web\"\"\"\n\nimport asyncio\nimport os\nimport re\nimport signal\nimport sys\nfrom types import FrameType\nfrom typing import Any, Optional  # noqa\n\nfrom gunicorn.config import AccessLogFormat as GunicornAccessLogFormat\nfrom gunicorn.workers import base\n\nfrom aiohttp import web\n\nfrom .helpers import set_result\nfrom .web_log import AccessLogger\n\n\ntry:\n    import ssl\n    SSLContext = ssl.SSLContext  # noqa\nexcept ImportError:  # pragma: no cover\n    ssl = None  # type: ignore\n    SSLContext = object  # type: ignore\n\n\n__all__ = ('GunicornWebWorker',\n           'GunicornUVLoopWebWorker',\n           'GunicornTokioWebWorker')\n\n\nclass GunicornWebWorker(base.Worker):\n\n    DEFAULT_AIOHTTP_LOG_FORMAT = AccessLogger.LOG_FORMAT\n    DEFAULT_GUNICORN_LOG_FORMAT = GunicornAccessLogFormat.default\n\n    def __init__(self, *args: Any, **kw: Any) -> None:  # pragma: no cover\n        super().__init__(*args, **kw)\n\n        self._runner = None  # type: Optional[web.AppRunner]\n        self._task = None  # type: Optional[asyncio.Task[None]]\n        self.exit_code = 0\n        self._notify_waiter = None  # type: Optional[asyncio.Future[bool]]\n\n    def init_process(self) -> None:\n        # create new event_loop after fork\n        asyncio.get_event_loop().close()\n\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(self.loop)\n\n        super().init_process()\n\n    def run(self) -> None:\n        access_log = self.log.access_log if self.cfg.accesslog else None\n        params = dict(\n            logger=self.log,\n            keepalive_timeout=self.cfg.keepalive,\n            access_log=access_log,\n            access_log_format=self._get_valid_log_format(\n                self.cfg.access_log_format))\n        if asyncio.iscoroutinefunction(self.wsgi):  # type: ignore\n            self.wsgi = self.loop.run_until_complete(\n                self.wsgi())  # type: ignore\n        self._runner = web.AppRunner(self.wsgi, **params)\n        self.loop.run_until_complete(self._runner.setup())\n        self._task = self.loop.create_task(self._run())\n\n        try:  # ignore all finalization problems\n            self.loop.run_until_complete(self._task)\n        except Exception as error:\n            self.log.exception(error)\n        if sys.version_info >= (3, 6):\n            if hasattr(self.loop, 'shutdown_asyncgens'):\n                self.loop.run_until_complete(self.loop.shutdown_asyncgens())\n        self.loop.close()\n\n        sys.exit(self.exit_code)\n\n    async def _run(self) -> None:\n        ctx = self._create_ssl_context(self.cfg) if self.cfg.is_ssl else None\n\n        runner = self._runner\n        assert runner is not None\n        server = runner.server\n        assert server is not None\n        for sock in self.sockets:\n            site = web.SockSite(\n                runner, sock, ssl_context=ctx,\n                shutdown_timeout=self.cfg.graceful_timeout / 100 * 95)\n            await site.start()\n\n        # If our parent changed then we shut down.\n        pid = os.getpid()\n        try:\n            while self.alive:  # type: ignore\n                self.notify()\n\n                cnt = server.requests_count\n                if self.cfg.max_requests and cnt > self.cfg.max_requests:\n                    self.alive = False\n                    self.log.info(\"Max requests, shutting down: %s\", self)\n\n                elif pid == os.getpid() and self.ppid != os.getppid():\n                    self.alive = False\n                    self.log.info(\"Parent changed, shutting down: %s\", self)\n                else:\n                    await self._wait_next_notify()\n        except BaseException:\n            pass\n\n        await runner.cleanup()\n\n    def _wait_next_notify(self) -> 'asyncio.Future[bool]':\n        self._notify_waiter_done()\n\n        loop = self.loop\n        assert loop is not None\n        self._notify_waiter = waiter = loop.create_future()\n        self.loop.call_later(1.0, self._notify_waiter_done, waiter)\n\n        return waiter\n\n    def _notify_waiter_done(self, waiter: 'asyncio.Future[bool]'=None) -> None:\n        if waiter is None:\n            waiter = self._notify_waiter\n        if waiter is not None:\n            set_result(waiter, True)\n\n        if waiter is self._notify_waiter:\n            self._notify_waiter = None\n\n    def init_signals(self) -> None:\n        # Set up signals through the event loop API.\n\n        self.loop.add_signal_handler(signal.SIGQUIT, self.handle_quit,\n                                     signal.SIGQUIT, None)\n\n        self.loop.add_signal_handler(signal.SIGTERM, self.handle_exit,\n                                     signal.SIGTERM, None)\n\n        self.loop.add_signal_handler(signal.SIGINT, self.handle_quit,\n                                     signal.SIGINT, None)\n\n        self.loop.add_signal_handler(signal.SIGWINCH, self.handle_winch,\n                                     signal.SIGWINCH, None)\n\n        self.loop.add_signal_handler(signal.SIGUSR1, self.handle_usr1,\n                                     signal.SIGUSR1, None)\n\n        self.loop.add_signal_handler(signal.SIGABRT, self.handle_abort,\n                                     signal.SIGABRT, None)\n\n        # Don't let SIGTERM and SIGUSR1 disturb active requests\n        # by interrupting system calls\n        signal.siginterrupt(signal.SIGTERM, False)\n        signal.siginterrupt(signal.SIGUSR1, False)\n\n    def handle_quit(self, sig: int, frame: FrameType) -> None:\n        self.alive = False\n\n        # worker_int callback\n        self.cfg.worker_int(self)\n\n        # wakeup closing process\n        self._notify_waiter_done()\n\n    def handle_abort(self, sig: int, frame: FrameType) -> None:\n        self.alive = False\n        self.exit_code = 1\n        self.cfg.worker_abort(self)\n        sys.exit(1)\n\n    @staticmethod\n    def _create_ssl_context(cfg: Any) -> 'SSLContext':\n        \"\"\" Creates SSLContext instance for usage in asyncio.create_server.\n\n        See ssl.SSLSocket.__init__ for more details.\n        \"\"\"\n        if ssl is None:  # pragma: no cover\n            raise RuntimeError('SSL is not supported.')\n\n        ctx = ssl.SSLContext(cfg.ssl_version)\n        ctx.load_cert_chain(cfg.certfile, cfg.keyfile)\n        ctx.verify_mode = cfg.cert_reqs\n        if cfg.ca_certs:\n            ctx.load_verify_locations(cfg.ca_certs)\n        if cfg.ciphers:\n            ctx.set_ciphers(cfg.ciphers)\n        return ctx\n\n    def _get_valid_log_format(self, source_format: str) -> str:\n        if source_format == self.DEFAULT_GUNICORN_LOG_FORMAT:\n            return self.DEFAULT_AIOHTTP_LOG_FORMAT\n        elif re.search(r'%\\([^\\)]+\\)', source_format):\n            raise ValueError(\n                \"Gunicorn's style options in form of `%(name)s` are not \"\n                \"supported for the log formatting. Please use aiohttp's \"\n                \"format specification to configure access log formatting: \"\n                \"http://docs.aiohttp.org/en/stable/logging.html\"\n                \"#format-specification\"\n            )\n        else:\n            return source_format\n\n\nclass GunicornUVLoopWebWorker(GunicornWebWorker):\n\n    def init_process(self) -> None:\n        import uvloop\n\n        # Close any existing event loop before setting a\n        # new policy.\n        asyncio.get_event_loop().close()\n\n        # Setup uvloop policy, so that every\n        # asyncio.get_event_loop() will create an instance\n        # of uvloop event loop.\n        asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())\n\n        super().init_process()\n\n\nclass GunicornTokioWebWorker(GunicornWebWorker):\n\n    def init_process(self) -> None:  # pragma: no cover\n        import tokio\n\n        # Close any existing event loop before setting a\n        # new policy.\n        asyncio.get_event_loop().close()\n\n        # Setup tokio policy, so that every\n        # asyncio.get_event_loop() will create an instance\n        # of tokio event loop.\n        asyncio.set_event_loop_policy(tokio.EventLoopPolicy())\n\n        super().init_process()\n", "path": "aiohttp/worker.py"}]}