Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup errors are silenced by gunicorn worke #3464

Closed
ods opened this issue Dec 25, 2018 · 2 comments
Closed

Cleanup errors are silenced by gunicorn worke #3464

ods opened this issue Dec 25, 2018 · 2 comments

Comments

@ods
Copy link
Contributor

ods commented Dec 25, 2018

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
@aio-libs-bot
Copy link

GitMate.io thinks the contributor most likely able to help you is @asvetlov.

Possibly related issues are #3242 (Error), #1203 (CookieJar error), #429 (Websocket error), #816 (Logging error), and #1762 (secure_proxy_ssl_header with gunicorn).

cognifloyd added a commit to cognifloyd/connexion that referenced this issue May 22, 2019
Somewhere between 3.5.1 and 3.5.2, the aiohttp reimport started
succeeding (in connexion.connexion.cli.run()). It's not clear which
change caused the issue, but it's probably one of:

- aio-libs/aiohttp#3469 (Remove wildcard imports)
- aio-libs/aiohttp#3464 (Don't suppress gunicorn cleanup errors)
- aio-libs/aiohttp#3471 (Refactor workers)
- aio-libs/aiohttp#3500 (Ignore done tasks)

In any case, setting sys.modules['aiohttp'] = None should prevent
reimporting it. See: https://stackoverflow.com/a/1350574

I successfully tested locally on py37 with aiohttp 3.5.1 and 3.5.2.
hjacobs pushed a commit to spec-first/connexion that referenced this issue Oct 15, 2019
* Revert "set max aiohttp version to 3.5.1 (until build is fixed) (#844)"

This reverts commit b2a4287.

* Fix test_run_with_aiohttp_not_installed

Somewhere between 3.5.1 and 3.5.2, the aiohttp reimport started
succeeding (in connexion.connexion.cli.run()). It's not clear which
change caused the issue, but it's probably one of:

- aio-libs/aiohttp#3469 (Remove wildcard imports)
- aio-libs/aiohttp#3464 (Don't suppress gunicorn cleanup errors)
- aio-libs/aiohttp#3471 (Refactor workers)
- aio-libs/aiohttp#3500 (Ignore done tasks)

In any case, setting sys.modules['aiohttp'] = None should prevent
reimporting it. See: https://stackoverflow.com/a/1350574

I successfully tested locally on py37 with aiohttp 3.5.1 and 3.5.2.
@lock
Copy link

lock bot commented Dec 27, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Dec 27, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants