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

[Bug] Webhooks fail to start under gunicorn 20.0.0 #85

Closed
techman83 opened this issue Nov 11, 2019 · 7 comments · Fixed by #105
Closed

[Bug] Webhooks fail to start under gunicorn 20.0.0 #85

techman83 opened this issue Nov 11, 2019 · 7 comments · Fixed by #105
Labels
Bug Something isn't working

Comments

@techman83
Copy link
Member

Background

After releasing the latest batch of changes the webhooks failed to start. Not being part of the python code, rather gunicorn it didn't send the logs to discord.

Worked around it by locking below 20.0.0 for now.

Problem

netkan@bef8cb5997ae:~/workspace$ gunicorn -b 0.0.0.0:5000 --access-logfile - "netkan.webhooks:create_app()"
[2019-11-11 03:31:32 +0000] [239] [INFO] Starting gunicorn 20.0.0
[2019-11-11 03:31:32 +0000] [239] [INFO] Listening at: http://0.0.0.0:5000 (239)
[2019-11-11 03:31:32 +0000] [239] [INFO] Using worker: sync
[2019-11-11 03:31:32 +0000] [243] [INFO] Booting worker with pid: 243
Failed to find application object 'create_app()' in 'netkan.webhooks'
[2019-11-11 03:31:33 +0000] [243] [INFO] Worker exiting (pid: 243)
[2019-11-11 03:31:33 +0000] [239] [INFO] Shutting down: Master
[2019-11-11 03:31:33 +0000] [239] [INFO] Reason: App failed to load.
@techman83 techman83 added the Bug Something isn't working label Nov 11, 2019
@HebaruSan
Copy link
Member

Huh. See benoitc/gunicorn#2159. Apparently app factories are just broken in that release.

@techman83
Copy link
Member Author

Well that'll explain it. Wonder if it's intentional.

@techman83
Copy link
Member Author

techman83 commented Nov 11, 2019

Looks to be a consequence of moving to using importlib as using __import__ directly is discouraged.

@HebaruSan
Copy link
Member

The Gunicorn and Flask devs are now chatting on that issue, and various users are weighing in with their perspectives. Sounds like they're leaning toward restoring the functionality but with a better implementation.

The reason I used the app factory pattern here has been mentioned by others in that discussion: running the tests loads all modules to find tests. When I tried a global variable app = Flask(__name__), tests would fail unless all the webhook os.environ context was set.

@techman83
Copy link
Member Author

I think the use of the factory pattern is appropriate here and it is configured as per the flask documentation. We can either keep it pinned to 19.9.x until they decide how they're going to sort this going forward. All the right people are talking about it, so it's no real biggie and we're not chomping to use anything in 20.x.x to my knowledge. Alternatively, we're not passing anything to the create app, so we could alter the launch slightly as per this comment. Personally I think pinning the version is appropriate in the interim.

@HebaruSan
Copy link
Member

Gunicorn 20.0.3 is out, and it works as far as I can tell.

@techman83
Copy link
Member Author

Awesome. We can unpin it at some point 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants