-
Notifications
You must be signed in to change notification settings - Fork 792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sprockets 3.3.X using old cached files #127
Comments
Use 3.3.4 |
Thanks! I tried 3.3.4 and it fixes the caching issue. Regarding deploying to production it looks like it is still looking for files in old folders. I tried to running Will I need to run Note the date is from a couple days ago as opposed to being today's date 20150902XXXXXX. Edit: I updated the |
💥 |
Thanks for the report, i'm glad it's working for you now. I think there still might be a bug here. Part of the cache key includes the version of sprockets that was used when you compiled so i'm not sure why you had to rev the version. |
Hi, we experiencing the same issue. Unfortunately updating to 3.3.4 doesn't help us. Also updating the |
Yeah I found that out the next day. I ended up using 3.2.0 for now. |
I re-opened the issue. Can either of you give me an example app that reproduces the problem? I can't fix what I can't reproduce, an example app would be hugely helpful. |
I was able to reproduce the problem under 3.3.4 with a scenario like the following: app/assets/outer.js rake assets:clobber It's part of a big app so it's hard to minimize. I'm happy to add log statements or debug it further if you can suggest things to look for. |
I will try to create an example app the next days. Will come back then. |
i also have this problem with both 3.3.3 and 3.3.4. but didn't investigate much yet |
@schneems I'm still trying to create an example app but couldn't reproduce it yet. I have one question thought. We still use the old extension format |
I discovered that rake assets:clobber wasn't actually clobbering the assets in my deployed environment (see #140), but unfortunately the stale asset problem still happens even with a manual clobber. It's quite reproducible in the deployed environment, but does not reproduce on my local dev box, even with the exact same revisions and with the Rails env set to the deployed environment temporarily. |
@wlipa You may be able to reproduce in development by making a copy of your app dir, symlinking the copy's |
Thanks for the suggestion. I tried that but it still works correctly on my dev box. |
One thing I find rather baffling is the way that cached dependencies contain references to the deployment release. For example: file-digest:///home/ops/apps/alpha.example.com/releases/20150922215431/app/assets/javascripts/preferences.js Doesn't referring directly to old releases that are still on the filesystem mean that we aren't picking up changes to these assets, because the dependency resolution code will calculate the digest based off the contents of the old asset? I would expect the dependency to be: file-digest:///home/ops/apps/alpha.example.com/current/app/assets/javascripts/preferences.js |
I think what may be happening is the line in loader.rb fetch_asset_from_dependency_cache that does an in-place expansion of the dependency paths for preexisting history is not getting undone in the scenario where we fall though to the second half of the function.
is an in-place modification of the history array of dependencies. There's a line in that second half which does path compression but only on the current asset. There's nothing that undoes the expand_from_root above.
So when the unshift happens, some absolute paths can get into the history cache.
|
…#127 and convience myself that upgrading to 3.4 fixes the production problem we were seeing.
When I run
cap staging deploy
orRAILS_ENV=staging bundle exec rake assets:precompile
on my staging/production server I get an old cached version of files I have modified.Changing the
Rails.config.assets.version
causes the cache to be invalidated as expected.Downgrading to 3.2.0 and lower fixes the issue.
I did some digging and it look like my issue is coming from Loader module.
The text was updated successfully, but these errors were encountered: