benoitc / gunicorn

gunicorn 'Green Unicorn' is a WSGI HTTP Server for UNIX, fast clients and sleepy applications.
http://www.gunicorn.org
Other
9.88k stars 1.76k forks source link

Template Rendering Shows Stale Content with Multiple Gunicorn Workers(docker+django+gunicorn) #3282

Open FrankFang0813 opened 3 months ago

FrankFang0813 commented 3 months ago

Hi I have a Issue, When running a Django application with multiple Gunicorn workers, I encounter an issue where template rendering shows stale content. Specifically, after navigating from one URL (e.g., foo/123) to another (e.g., foo/456), the rendered page sometimes displays content from the previous URL (foo/123) instead of the current one. This issue does not occur when only a single worker is configured.

Thank you!

benoitc commented 3 months ago

what does your app looks like? you need to endure that the urls are not lozded globally. and tjis should work.

Le mar. 20 août 2024 à 18:38, FrankFang0813 @.***> a écrit :

Hi I have a Issue, When running a Django application with multiple Gunicorn workers, I encounter an issue where template rendering shows stale content. Specifically, after navigating from one URL (e.g., foo/123) to another (e.g., foo/456), the rendered page sometimes displays content from the previous URL (foo/123) instead of the current one. This issue does not occur when only a single worker is configured.

Thank you!

— Reply to this email directly, view it on GitHub https://github.com/benoitc/gunicorn/issues/3282, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADRIXETQ7A4TCMO4WXWJDZSNWIXAVCNFSM6AAAAABM2I6XUOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3TMMBYGY3TMNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

FrankFang0813 commented 3 months ago

I'm using Dash to build my layout, and my URLs are dynamically generated. I've verified that the parameters( request and context) passed during render are correct.

However, when I use multiple workers, the URL are correct, but the displayed page shows the content from the previous URL.

When I use a single worker, this issue doesn't occur.

pajod commented 3 months ago

I could imagine a number of ways how this could go wrong, including but not limited to:

You need to provide enough code and the method of deployment to review or reproduce.