propshaft: Propshaft race condition with webpack creates 410 with dynamic chunk loading
Hi, first of all, thanks a lot for developing this new solution. We are using it in production and are quite happy. One issue we bump into quite frequently though is in development.
We use webpack and depend on dynamic chunk loading. That means that webpack needs to compile these chunks already with a hash and a “.digested” suffix. We also use LiveReload from webpack to refresh the page after each compilation automatically.
What we observed is that when we apply multiple changes in succession, then a dynamic chunk request might return a 410. We debugged the code and could see that the asset wasn’t in the @cached_assets_by_path. We also saw that propshaft clears the cache when any of the files in app/assets/builds changes. We suspect that there is some kind of race-condition between webpack and propshaft, clearing the cache, compiling multiple times and refreshing the browser at the same time.
We also noted that the digested assets created by webpack accumulate over time which could also slow down the creations of cached_assets_by_path. This accumulation happens also in production and doesn’t get cleared by assets:clear.
We tried to find a reproducible example but since it is likely a race condition it is very hard. We would appreciate any thoughts and pointers.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 16 (7 by maintainers)
Commits related to this issue
- fixes #110 avoid race condition when clearing/using assets cache — committed to gingerlime/propshaft by gingerlime 4 years ago
I did mean 0.9, yes. If you’re talking about cleanup of digested files, I don’t know that there is a straight shot there. It’s also not a problem that affects modern containerized deployments, since they’ll have a clean build every time.