René's URL Explorer Experiment


Title: Issue: Sticky Session / Session Affinity Not Working with Azure Web App + FastAPI +FastMCP + Gunicorn · Issue #1350 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Issue: Sticky Session / Session Affinity Not Working with Azure Web App + FastAPI +FastMCP + Gunicorn · Issue #1350 · modelcontextprotocol/python-sdk

X Title: Issue: Sticky Session / Session Affinity Not Working with Azure Web App + FastAPI +FastMCP + Gunicorn · Issue #1350 · modelcontextprotocol/python-sdk

Description: Question Context I’m running a FastAPI application on Azure Web App (Linux, containerized) using Gunicorn + Uvicorn workers. The app is an MCP (Model Context Protocol) server that connects to Rally via pyral. Because Rally connections ar...

Open Graph Description: Question Context I’m running a FastAPI application on Azure Web App (Linux, containerized) using Gunicorn + Uvicorn workers. The app is an MCP (Model Context Protocol) server that connects to Rally...

X Description: Question Context I’m running a FastAPI application on Azure Web App (Linux, containerized) using Gunicorn + Uvicorn workers. The app is an MCP (Model Context Protocol) server that connects to Rally...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/1350

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Issue: Sticky Session / Session Affinity Not Working with Azure Web App + FastAPI +FastMCP + Gunicorn","articleBody":"### Question\n\n### **Context**\n\nI’m running a FastAPI application on Azure Web App (Linux, containerized) using Gunicorn + Uvicorn workers.\n\nThe app is an MCP (Model Context Protocol) server that connects to Rally via pyral.\nBecause Rally connections are cached per worker, all requests from the same client need to be routed to the same worker.\n\nIf a request lands on a different worker, the Rally API responds with a BAD session ID error because the cached connection is no longer valid.\n\n### **What I Tried**\n\n**1. Gunicorn Startup Command**\n\n```\ngunicorn -k uvicorn.workers.UvicornWorker \\\n  -w 2 \\\n  -b 0.0.0.0:8000 \\\n  main:app \\\n  --keep-alive 120 \\\n  --timeout 240 \\\n  --worker-connections 1000 \\\n  --max-requests 1000 \\\n  --max-requests-jitter 50 \\\n  --preload \\\n  --log-level info\n\n```\n\n**2. Custom Session Middleware (FastAPI)**\n\n\u003e Validates that a request always maps back to the same worker.\n\n**3. Debugging**\n\n\u003e Logged worker PID + session ID on each request.\n\u003e \n\u003e Observed the same client’s requests hitting different workers intermittently.\n\u003e \n\u003e Example log:\n\u003e \n\u003e Worker 1234 → Session=sess_abc_1234\n\u003e Worker 5678 → Session=sess_def_5678   # Same client, different worker\n\n### **Problem**\n\n\u003e Client requests are not consistently routed to the same Gunicorn worker.\n\u003e \n\u003e Cached Rally sessions exist only in the worker process that created them.\n\u003e \n\u003e When a client hits another worker, Rally rejects the request with BAD session ID.\n\n**Expected Behavior**\n\n\u003e All requests from a given client should always land on the same worker.\n\u003e \n\u003e Session affinity should be preserved consistently until session expiry.\n\n**### Questions for the Community**\n\n1. Is it possible to achieve worker-level sticky sessions with FastAPI + Gunicorn on Azure Web App?\n\n2. Should I run a single worker per instance (e.g., --workers 1) to avoid this problem (I Actually tried and found out the Server crashes a lot )? \n\n2. Should I share Rally session state across workers (e.g., Redis or DB-backed session store) instead of relying on per-worker caching(Tried it but due to mounting with FASTAPI, the session management didn't got intercepted for the main MCP server URL)?\n\n**Note:**\n\nHave to use statefull http as using sampling/elicitation in my server\n\n\n``` \nmcp = FastMCP(\"Rally MCP Server\",stateless_http=True)\n\n```\n\n\n\n### Additional Context\n\nEnvironment\n\nAzure Web App (Linux, Code Deploy)\n\nFastAPI + Gunicorn + Uvicorn workers\n\nPython 3.13\n\npyral (Rally API client)","author":{"url":"https://github.com/swapnlv","@type":"Person","name":"swapnlv"},"datePublished":"2025-09-08T03:21:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1350/python-sdk/issues/1350"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:ed071c65-02a6-b5a2-5462-17e5f3940903
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8F90:23A0E5:280B88:36C5E7:6A5A5E9A
html-safe-nonce0c3f77bcda61f99c5806878f3e0efd732ab69ab947c47e8d396bc6350eba6f97
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjkwOjIzQTBFNToyODBCODg6MzZDNUU3OjZBNUE1RTlBIiwidmlzaXRvcl9pZCI6Ijc4Njk3NDUzOTM3MzUxOTYzMTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac9dafff7c6fc8ad287177e62c7ebf5aa983bc6c094739c4b87df252f0aa3ca116
hovercard-subject-tagissue:3392435009
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/1350/issue_layout
twitter:imagehttps://opengraph.githubassets.com/29a9af8ef6a9f58d2f5528d69be3e4e9ad054e255b4244dfeb7158b10e236917/modelcontextprotocol/python-sdk/issues/1350
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/29a9af8ef6a9f58d2f5528d69be3e4e9ad054e255b4244dfeb7158b10e236917/modelcontextprotocol/python-sdk/issues/1350
og:image:altQuestion Context I’m running a FastAPI application on Azure Web App (Linux, containerized) using Gunicorn + Uvicorn workers. The app is an MCP (Model Context Protocol) server that connects to Rally...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameswapnlv
hostnamegithub.com
expected-hostnamegithub.com
None05b9ddf6a47d2dbe13944873a99f5fb4b83ba4871f9cb8a8e256793a63ca9687
turbo-cache-controlno-preview
go-importgithub.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git
octolytics-dimension-user_id182288589
octolytics-dimension-user_loginmodelcontextprotocol
octolytics-dimension-repository_id862584018
octolytics-dimension-repository_nwomodelcontextprotocol/python-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id862584018
octolytics-dimension-repository_network_root_nwomodelcontextprotocol/python-sdk
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef8d29d1bd03dda2dd14b3f80b8bc27e1111f43bd
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/1350#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F1350
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F1350
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/1350
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/1350
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/1350
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/issues/1350
modelcontextprotocol https://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Notifications https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Fork 3.7k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Star 23.6k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Code https://github.com/modelcontextprotocol/python-sdk
Issues 256 https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests 303 https://github.com/modelcontextprotocol/python-sdk/pulls
Actions https://github.com/modelcontextprotocol/python-sdk/actions
Projects https://github.com/modelcontextprotocol/python-sdk/projects
Models https://github.com/modelcontextprotocol/python-sdk/models
Security and quality 6 https://github.com/modelcontextprotocol/python-sdk/security
Insights https://github.com/modelcontextprotocol/python-sdk/pulse
Code https://github.com/modelcontextprotocol/python-sdk
Issues https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests https://github.com/modelcontextprotocol/python-sdk/pulls
Actions https://github.com/modelcontextprotocol/python-sdk/actions
Projects https://github.com/modelcontextprotocol/python-sdk/projects
Models https://github.com/modelcontextprotocol/python-sdk/models
Security and quality https://github.com/modelcontextprotocol/python-sdk/security
Insights https://github.com/modelcontextprotocol/python-sdk/pulse
#880https://github.com/modelcontextprotocol/python-sdk/issues/880
#880https://github.com/modelcontextprotocol/python-sdk/issues/880
Issue: Sticky Session / Session Affinity Not Working with Azure Web App + FastAPI +FastMCP + Gunicornhttps://github.com/modelcontextprotocol/python-sdk/issues/1350#top
P1Significant bug affecting many users, highly requested featurehttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P1%22
documentationImprovements or additions to documentationhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22documentation%22
ready for workEnough information for someone to start working onhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22ready%20for%20work%22
https://github.com/swapnlv
swapnlvhttps://github.com/swapnlv
on Sep 8, 2025https://github.com/modelcontextprotocol/python-sdk/issues/1350#issue-3392435009
P1Significant bug affecting many users, highly requested featurehttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P1%22
documentationImprovements or additions to documentationhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22documentation%22
ready for workEnough information for someone to start working onhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22ready%20for%20work%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.