gunicorn icon indicating copy to clipboard operation
gunicorn copied to clipboard

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

Open FrankFang0813 opened this issue 1 year ago • 3 comments

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!

FrankFang0813 avatar Aug 20 '24 16:08 FrankFang0813

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: @.***>

benoitc avatar Aug 20 '24 17:08 benoitc

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.

FrankFang0813 avatar Aug 20 '24 17:08 FrankFang0813

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

  • the requests being entirely correct, but a Javascript front-end failing to update interface after faking navigation
  • thread safety flaws in generating the dynamically generated URL
  • cross-thread synchronization flaws in propagating the link between URL and content
  • caching or state sharing mechanism storing or retrieving data on inappropriate keys
  • HTTP request and/or response de-sync between some front-end proxy and Gunicorn Only the last example would indicate a (serious) bug in Gunicorn.

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

pajod avatar Aug 20 '24 20:08 pajod