From ca0d73bd9ffedde4b0741474520287a521bb22b2 Mon Sep 17 00:00:00 2001 From: Paolo Salvatori Date: Tue, 26 May 2026 10:06:54 +0200 Subject: [PATCH 1/2] Improve Vacation Planner Implementation --- .../python/src/gunicorn.conf.py | 18 ++++++++++++++++++ .../python/src/requirements.txt | 8 ++++---- .../python/src/gunicorn.conf.py | 18 ++++++++++++++++++ .../python/src/requirements.txt | 8 ++++---- .../python/src/gunicorn.conf.py | 18 ++++++++++++++++++ .../python/src/requirements.txt | 10 +++++----- .../python/src/gunicorn.conf.py | 18 ++++++++++++++++++ .../python/src/requirements.txt | 8 ++++---- 8 files changed, 89 insertions(+), 17 deletions(-) create mode 100644 samples/web-app-cosmosdb-mongodb-api/python/src/gunicorn.conf.py create mode 100644 samples/web-app-cosmosdb-nosql-api/python/src/gunicorn.conf.py create mode 100644 samples/web-app-managed-identity/python/src/gunicorn.conf.py create mode 100644 samples/web-app-sql-database/python/src/gunicorn.conf.py diff --git a/samples/web-app-cosmosdb-mongodb-api/python/src/gunicorn.conf.py b/samples/web-app-cosmosdb-mongodb-api/python/src/gunicorn.conf.py new file mode 100644 index 0000000..cb87ebc --- /dev/null +++ b/samples/web-app-cosmosdb-mongodb-api/python/src/gunicorn.conf.py @@ -0,0 +1,18 @@ +import os + + +def worker_int(worker): + # SIGINT (Ctrl+C) default path raises SystemExit inside the worker's recv() + # loop, dumping a traceback through gunicorn's HTTP parser frames. os._exit + # short-circuits the unwind for a clean foreground stop. SIGTERM (graceful) + # is unaffected — it goes through a different code path. + os._exit(0) + + +def worker_abort(worker): + # SIGABRT is what the arbiter sends when a worker misses its heartbeat + # ([CRITICAL] WORKER TIMEOUT). The default handler does sys.exit(1), which + # unwinds through the same recv() stack as SIGINT and prints a misleading + # traceback. The WORKER TIMEOUT log line above it is the real diagnostic; + # exit at the C level to suppress the spurious trace. + os._exit(1) diff --git a/samples/web-app-cosmosdb-mongodb-api/python/src/requirements.txt b/samples/web-app-cosmosdb-mongodb-api/python/src/requirements.txt index 646405e..be9dff6 100644 --- a/samples/web-app-cosmosdb-mongodb-api/python/src/requirements.txt +++ b/samples/web-app-cosmosdb-mongodb-api/python/src/requirements.txt @@ -1,5 +1,5 @@ Flask==3.1.3 -azure-identity==1.25.1 -pymongo==4.15.3 -gunicorn==23.0.0 -python-dotenv==1.2.2 \ No newline at end of file +azure-identity==1.25.3 +pymongo==4.17.0 +gunicorn==26.0.0 +python-dotenv==1.2.2 diff --git a/samples/web-app-cosmosdb-nosql-api/python/src/gunicorn.conf.py b/samples/web-app-cosmosdb-nosql-api/python/src/gunicorn.conf.py new file mode 100644 index 0000000..cb87ebc --- /dev/null +++ b/samples/web-app-cosmosdb-nosql-api/python/src/gunicorn.conf.py @@ -0,0 +1,18 @@ +import os + + +def worker_int(worker): + # SIGINT (Ctrl+C) default path raises SystemExit inside the worker's recv() + # loop, dumping a traceback through gunicorn's HTTP parser frames. os._exit + # short-circuits the unwind for a clean foreground stop. SIGTERM (graceful) + # is unaffected — it goes through a different code path. + os._exit(0) + + +def worker_abort(worker): + # SIGABRT is what the arbiter sends when a worker misses its heartbeat + # ([CRITICAL] WORKER TIMEOUT). The default handler does sys.exit(1), which + # unwinds through the same recv() stack as SIGINT and prints a misleading + # traceback. The WORKER TIMEOUT log line above it is the real diagnostic; + # exit at the C level to suppress the spurious trace. + os._exit(1) diff --git a/samples/web-app-cosmosdb-nosql-api/python/src/requirements.txt b/samples/web-app-cosmosdb-nosql-api/python/src/requirements.txt index dcde1b7..c55ed85 100644 --- a/samples/web-app-cosmosdb-nosql-api/python/src/requirements.txt +++ b/samples/web-app-cosmosdb-nosql-api/python/src/requirements.txt @@ -1,6 +1,6 @@ Flask==3.1.3 -azure-mgmt-cosmosdb==9.8.0 -azure-cosmos==4.7.0 -gunicorn==22.0.0 +azure-mgmt-cosmosdb==9.9.0 +azure-cosmos==4.15.0 +gunicorn==26.0.0 python-dotenv==1.2.2 -setuptools==79.0.1 +setuptools==82.0.1 diff --git a/samples/web-app-managed-identity/python/src/gunicorn.conf.py b/samples/web-app-managed-identity/python/src/gunicorn.conf.py new file mode 100644 index 0000000..cb87ebc --- /dev/null +++ b/samples/web-app-managed-identity/python/src/gunicorn.conf.py @@ -0,0 +1,18 @@ +import os + + +def worker_int(worker): + # SIGINT (Ctrl+C) default path raises SystemExit inside the worker's recv() + # loop, dumping a traceback through gunicorn's HTTP parser frames. os._exit + # short-circuits the unwind for a clean foreground stop. SIGTERM (graceful) + # is unaffected — it goes through a different code path. + os._exit(0) + + +def worker_abort(worker): + # SIGABRT is what the arbiter sends when a worker misses its heartbeat + # ([CRITICAL] WORKER TIMEOUT). The default handler does sys.exit(1), which + # unwinds through the same recv() stack as SIGINT and prints a misleading + # traceback. The WORKER TIMEOUT log line above it is the real diagnostic; + # exit at the C level to suppress the spurious trace. + os._exit(1) diff --git a/samples/web-app-managed-identity/python/src/requirements.txt b/samples/web-app-managed-identity/python/src/requirements.txt index 3770ecd..edf5663 100644 --- a/samples/web-app-managed-identity/python/src/requirements.txt +++ b/samples/web-app-managed-identity/python/src/requirements.txt @@ -1,6 +1,6 @@ Flask==3.1.3 -azure-identity==1.16.1 -azure-storage-blob==12.26.0 -azure-core==1.38.0 -gunicorn==23.0.0 -python-dotenv==1.2.2 \ No newline at end of file +azure-identity==1.25.3 +azure-storage-blob==12.29.0 +azure-core==1.41.0 +gunicorn==26.0.0 +python-dotenv==1.2.2 diff --git a/samples/web-app-sql-database/python/src/gunicorn.conf.py b/samples/web-app-sql-database/python/src/gunicorn.conf.py new file mode 100644 index 0000000..cb87ebc --- /dev/null +++ b/samples/web-app-sql-database/python/src/gunicorn.conf.py @@ -0,0 +1,18 @@ +import os + + +def worker_int(worker): + # SIGINT (Ctrl+C) default path raises SystemExit inside the worker's recv() + # loop, dumping a traceback through gunicorn's HTTP parser frames. os._exit + # short-circuits the unwind for a clean foreground stop. SIGTERM (graceful) + # is unaffected — it goes through a different code path. + os._exit(0) + + +def worker_abort(worker): + # SIGABRT is what the arbiter sends when a worker misses its heartbeat + # ([CRITICAL] WORKER TIMEOUT). The default handler does sys.exit(1), which + # unwinds through the same recv() stack as SIGINT and prints a misleading + # traceback. The WORKER TIMEOUT log line above it is the real diagnostic; + # exit at the C level to suppress the spurious trace. + os._exit(1) diff --git a/samples/web-app-sql-database/python/src/requirements.txt b/samples/web-app-sql-database/python/src/requirements.txt index 5fd779d..aa9cd89 100644 --- a/samples/web-app-sql-database/python/src/requirements.txt +++ b/samples/web-app-sql-database/python/src/requirements.txt @@ -1,8 +1,8 @@ Flask==3.1.3 azure-identity==1.25.3 pyodbc==5.3.0 -gunicorn==25.3.0 +gunicorn==26.0.0 python-dotenv==1.2.2 -azure-keyvault-secrets==4.10.0 -azure-keyvault-certificates==4.10.0 -cryptography==46.0.7 \ No newline at end of file +azure-keyvault-secrets==4.11.0 +azure-keyvault-certificates==4.11.1 +cryptography==48.0.0 From d04e3ec097ce4892bcfacc2776a6afe4e3359e8f Mon Sep 17 00:00:00 2001 From: Paolo Salvatori Date: Tue, 26 May 2026 10:17:15 +0200 Subject: [PATCH 2/2] Add gunicorn.conf.py to zip file --- samples/web-app-cosmosdb-mongodb-api/python/bicep/deploy.sh | 2 +- samples/web-app-cosmosdb-mongodb-api/python/scripts/deploy.sh | 2 +- samples/web-app-cosmosdb-mongodb-api/python/terraform/deploy.sh | 2 +- samples/web-app-cosmosdb-nosql-api/python/scripts/deploy.sh | 2 +- samples/web-app-managed-identity/python/bicep/deploy.sh | 2 +- .../web-app-managed-identity/python/scripts/system-assigned.sh | 2 +- .../web-app-managed-identity/python/scripts/user-assigned.sh | 2 +- samples/web-app-managed-identity/python/terraform/deploy.sh | 2 +- samples/web-app-sql-database/python/bicep/deploy.sh | 2 +- samples/web-app-sql-database/python/scripts/deploy.sh | 2 +- samples/web-app-sql-database/python/terraform/deploy.sh | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/samples/web-app-cosmosdb-mongodb-api/python/bicep/deploy.sh b/samples/web-app-cosmosdb-mongodb-api/python/bicep/deploy.sh index 33d3952..2a8cbbb 100755 --- a/samples/web-app-cosmosdb-mongodb-api/python/bicep/deploy.sh +++ b/samples/web-app-cosmosdb-mongodb-api/python/bicep/deploy.sh @@ -134,7 +134,7 @@ fi # Create the zip package of the web app echo "Creating zip package of the web app..." -zip -r "$ZIPFILE" app.py mongodb.py static templates requirements.txt +zip -r "$ZIPFILE" app.py mongodb.py gunicorn.conf.py static templates requirements.txt # Deploy the web app # Deploy the web app diff --git a/samples/web-app-cosmosdb-mongodb-api/python/scripts/deploy.sh b/samples/web-app-cosmosdb-mongodb-api/python/scripts/deploy.sh index a9b3408..ae41202 100755 --- a/samples/web-app-cosmosdb-mongodb-api/python/scripts/deploy.sh +++ b/samples/web-app-cosmosdb-mongodb-api/python/scripts/deploy.sh @@ -919,7 +919,7 @@ fi # Create the zip package of the web app echo "Creating zip package of the web app..." -zip -r "$ZIPFILE" app.py mongodb.py static templates requirements.txt +zip -r "$ZIPFILE" app.py mongodb.py gunicorn.conf.py static templates requirements.txt # List the contents of the zip package echo "Contents of the zip package [$ZIPFILE]:" diff --git a/samples/web-app-cosmosdb-mongodb-api/python/terraform/deploy.sh b/samples/web-app-cosmosdb-mongodb-api/python/terraform/deploy.sh index ef3f570..5a3e0dd 100755 --- a/samples/web-app-cosmosdb-mongodb-api/python/terraform/deploy.sh +++ b/samples/web-app-cosmosdb-mongodb-api/python/terraform/deploy.sh @@ -61,7 +61,7 @@ fi # Create the zip package of the web app echo "Creating zip package of the web app..." -zip -r "$ZIPFILE" app.py mongodb.py static templates requirements.txt +zip -r "$ZIPFILE" app.py mongodb.py gunicorn.conf.py static templates requirements.txt # Deploy the web app # Deploy the web app diff --git a/samples/web-app-cosmosdb-nosql-api/python/scripts/deploy.sh b/samples/web-app-cosmosdb-nosql-api/python/scripts/deploy.sh index 934a013..22f49b2 100755 --- a/samples/web-app-cosmosdb-nosql-api/python/scripts/deploy.sh +++ b/samples/web-app-cosmosdb-nosql-api/python/scripts/deploy.sh @@ -108,7 +108,7 @@ fi # Create the zip package of the web app echo "Creating zip package of the web app..." -zip -r "$ZIPFILE" app.py cosmosdb_client.py static templates requirements.txt +zip -r "$ZIPFILE" app.py cosmosdb_client.py gunicorn.conf.py static templates requirements.txt # Deploy the web app echo "Deploying web app [$WEB_APP_NAME] with zip file [$ZIPFILE]..." diff --git a/samples/web-app-managed-identity/python/bicep/deploy.sh b/samples/web-app-managed-identity/python/bicep/deploy.sh index 3436b36..9b5e148 100755 --- a/samples/web-app-managed-identity/python/bicep/deploy.sh +++ b/samples/web-app-managed-identity/python/bicep/deploy.sh @@ -129,7 +129,7 @@ fi # Create the zip package of the web app echo "Creating zip package of the web app..." -zip -r "$ZIPFILE" app.py requirements.txt static templates +zip -r "$ZIPFILE" app.py gunicorn.conf.py requirements.txt static templates # Deploy the web app echo "Deploying web app [$WEB_APP_NAME] with zip file [$ZIPFILE]..." diff --git a/samples/web-app-managed-identity/python/scripts/system-assigned.sh b/samples/web-app-managed-identity/python/scripts/system-assigned.sh index fc27447..fc926ed 100755 --- a/samples/web-app-managed-identity/python/scripts/system-assigned.sh +++ b/samples/web-app-managed-identity/python/scripts/system-assigned.sh @@ -248,7 +248,7 @@ fi # Create the zip package of the web app echo "Creating zip package of the web app..." -zip -r "$ZIPFILE" app.py requirements.txt static templates +zip -r "$ZIPFILE" app.py gunicorn.conf.py requirements.txt static templates # Deploy the web app echo "Deploying web app [$WEB_APP_NAME] with zip file [$ZIPFILE]..." diff --git a/samples/web-app-managed-identity/python/scripts/user-assigned.sh b/samples/web-app-managed-identity/python/scripts/user-assigned.sh index bb5381b..9ae868a 100755 --- a/samples/web-app-managed-identity/python/scripts/user-assigned.sh +++ b/samples/web-app-managed-identity/python/scripts/user-assigned.sh @@ -332,7 +332,7 @@ fi # Create the zip package of the web app echo "Creating zip package of the web app..." -zip -r "$ZIPFILE" app.py requirements.txt static templates +zip -r "$ZIPFILE" app.py gunicorn.conf.py requirements.txt static templates # Deploy the web app echo "Deploying web app [$WEB_APP_NAME] with zip file [$ZIPFILE]..." diff --git a/samples/web-app-managed-identity/python/terraform/deploy.sh b/samples/web-app-managed-identity/python/terraform/deploy.sh index 884fd5a..16441f6 100755 --- a/samples/web-app-managed-identity/python/terraform/deploy.sh +++ b/samples/web-app-managed-identity/python/terraform/deploy.sh @@ -52,7 +52,7 @@ fi # Create the zip package of the web app echo "Creating zip package of the web app..." -zip -r "$ZIPFILE" app.py activities.py database.py static templates requirements.txt +zip -r "$ZIPFILE" app.py gunicorn.conf.py activities.py database.py static templates requirements.txt # Deploy the web app echo "Deploying web app [$WEB_APP_NAME] with zip file [$ZIPFILE]..." diff --git a/samples/web-app-sql-database/python/bicep/deploy.sh b/samples/web-app-sql-database/python/bicep/deploy.sh index 7d1f395..efbe9a6 100755 --- a/samples/web-app-sql-database/python/bicep/deploy.sh +++ b/samples/web-app-sql-database/python/bicep/deploy.sh @@ -295,7 +295,7 @@ fi # Create the zip package of the web app echo "Creating zip package of the web app..." -zip -r "$ZIPFILE" app.py activities.py certificates.py database.py static templates requirements.txt +zip -r "$ZIPFILE" app.py gunicorn.conf.py activities.py certificates.py database.py static templates requirements.txt # Deploy the web app echo "Deploying web app [$WEB_APP_NAME] with zip file [$ZIPFILE]..." diff --git a/samples/web-app-sql-database/python/scripts/deploy.sh b/samples/web-app-sql-database/python/scripts/deploy.sh index efa87d0..eed9ec0 100755 --- a/samples/web-app-sql-database/python/scripts/deploy.sh +++ b/samples/web-app-sql-database/python/scripts/deploy.sh @@ -450,7 +450,7 @@ fi # Create the zip package of the web app echo "Creating zip package of the web app..." -zip -r "$ZIPFILE" app.py activities.py database.py certificates.py static templates requirements.txt +zip -r "$ZIPFILE" app.py gunicorn.conf.py activities.py database.py certificates.py static templates requirements.txt # Deploy the web app echo "Deploying web app [$WEB_APP_NAME] with zip file [$ZIPFILE]..." diff --git a/samples/web-app-sql-database/python/terraform/deploy.sh b/samples/web-app-sql-database/python/terraform/deploy.sh index 50bb8a3..fa99296 100755 --- a/samples/web-app-sql-database/python/terraform/deploy.sh +++ b/samples/web-app-sql-database/python/terraform/deploy.sh @@ -217,7 +217,7 @@ fi # Create the zip package of the web app echo "Creating zip package of the web app..." -zip -r "$ZIPFILE" app.py activities.py database.py certificates.py static templates requirements.txt +zip -r "$ZIPFILE" app.py gunicorn.conf.py activities.py database.py certificates.py static templates requirements.txt # Deploy the web app echo "Deploying web app [$WEB_APP_NAME] with zip file [$ZIPFILE]..."