Improve Vacation Planner Implementation#93
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Python “Vacation Planner” web-app samples to (1) suppress misleading Gunicorn tracebacks during worker shutdown/timeout by adding per-sample gunicorn.conf.py hooks, and (2) bump pinned dependencies in each sample’s requirements.txt to newer versions.
Changes:
- Added
src/gunicorn.conf.pyto each of the fourvacation-plannerFlask samples, overridingworker_int/worker_abortto callos._exit(...). - Updated pinned package versions (notably
gunicorn==26.0.0across all four samples, plus Azure SDK / DB-related deps where applicable).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| samples/web-app-sql-database/python/src/requirements.txt | Bumps Gunicorn + Key Vault + cryptography pins for the SQL Database sample. |
| samples/web-app-sql-database/python/src/gunicorn.conf.py | Adds Gunicorn worker signal hooks to avoid tracebacks on exit/timeout. |
| samples/web-app-managed-identity/python/src/requirements.txt | Updates Azure SDK + Gunicorn pins for the Managed Identity sample. |
| samples/web-app-managed-identity/python/src/gunicorn.conf.py | Adds Gunicorn worker signal hooks to avoid tracebacks on exit/timeout. |
| samples/web-app-cosmosdb-nosql-api/python/src/requirements.txt | Updates Cosmos/management SDK + Gunicorn + setuptools pins for the NoSQL sample. |
| samples/web-app-cosmosdb-nosql-api/python/src/gunicorn.conf.py | Adds Gunicorn worker signal hooks to avoid tracebacks on exit/timeout. |
| samples/web-app-cosmosdb-mongodb-api/python/src/requirements.txt | Updates azure-identity/pymongo + Gunicorn pins for the MongoDB API sample. |
| samples/web-app-cosmosdb-mongodb-api/python/src/gunicorn.conf.py | Adds Gunicorn worker signal hooks to avoid tracebacks on exit/timeout. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Two cosmetic but recurring runtime issues affect all four
vacation-plannerweb-app samples when running on Azure App Service / Oryx-launched gunicorn:worker_inthandler raisesSystemExit(0)inside the worker'ssocket.recv()loop, which unwinds through gunicorn's HTTP parser frames and dumps a misleading stack trace before the process exits.SIGABRT. The defaultworker_aborthandler doessys.exit(1), which unwinds through the samerecv()stack and prints a stack trace after the genuine[CRITICAL] WORKER TIMEOUT (pid:N)diagnostic line — making logs noisier and harder to read.Both issues are signal-handling artifacts, not application bugs. The proper fix is to override gunicorn's per-worker signal hooks with
os._exit()calls that bypass the Python exception unwind.Separately, the pinned dependency versions in each
requirements.txthad drifted behind the latest stable PyPI releases. Bumping them in the same PR keeps the samples on supported, security-patched dependencies — includinggunicorn 26.0.0, the same version used by these hooks.Changes
New files — each sample gets a
src/gunicorn.conf.pywith the same two hook overrides. Gunicorn auto-discovers./gunicorn.conf.pyfrom the working directory on App Service (/home/site/wwwroot), so no Oryx startup-command override is required.web-app-cosmosdb-mongodb-api/python/src/gunicorn.conf.pyweb-app-cosmosdb-nosql-api/python/src/gunicorn.conf.pyweb-app-managed-identity/python/src/gunicorn.conf.pyweb-app-sql-database/python/src/gunicorn.conf.pyEach file defines:
worker_int(worker)→os._exit(0). Suppresses the SystemExit traceback on SIGINT/SIGQUIT. SIGTERM (graceful shutdown) goes through a different code path and is unaffected.worker_abort(worker)→os._exit(1). Suppresses the SystemExit traceback on SIGABRT (worker timeout). The[CRITICAL] WORKER TIMEOUTlog line — the genuine diagnostic — is still emitted.Modified files — each
requirements.txtbumped to the latest stable PyPI version per package.Flask,python-dotenv, andpyodbcwere already at latest; only behind-versions are listed below.web-app-cosmosdb-mongodb-api/python/src/requirements.txtazure-identity: 1.25.1 → 1.25.3pymongo: 4.15.3 → 4.17.0gunicorn: 23.0.0 → 26.0.0web-app-cosmosdb-nosql-api/python/src/requirements.txtazure-mgmt-cosmosdb: 9.8.0 → 9.9.0azure-cosmos: 4.7.0 → 4.15.0gunicorn: 22.0.0 → 26.0.0setuptools: 79.0.1 → 82.0.1web-app-managed-identity/python/src/requirements.txtazure-identity: 1.16.1 → 1.25.3azure-storage-blob: 12.26.0 → 12.29.0azure-core: 1.38.0 → 1.41.0gunicorn: 23.0.0 → 26.0.0web-app-sql-database/python/src/requirements.txtgunicorn: 25.3.0 → 26.0.0azure-keyvault-secrets: 4.10.0 → 4.11.0azure-keyvault-certificates: 4.10.0 → 4.11.1cryptography: 46.0.7 → 48.0.0No application code, templates, static assets, scripts, or IaC was touched. Behavior of each sample is unchanged at the request-handling layer; only signal handling and dependency floors move.