-
Notifications
You must be signed in to change notification settings - Fork 791
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
FileStore cache patch in v3.6 causes directory name collisions in Windows #283
Comments
+downcase. Affects OS X too.
|
Is there a hashing algorithm that produces lowercase characters only in their results string? Splitting the string and down-casing on every cache lookup would be expensive :( |
Touching the filesystem has got to be an order of magnitude more expensive than downcasing a couple chars. We're already splitting the string to get the dir name, huh? |
The current implementation can have collisions for the whole asset, would be nice to not have to do that. Not sure about your filesystem comment, we're already having to read in the contents to create the digest, was suggesting maybe there exists a different digest algorithm that produces strings without varying case. |
For example |
Gotcha. Speaking to:
to suggest that we're already splitting the string and that downcasing is inexpensive 😊 |
Started adding routes and route specs. Rolled back sprockets dependency due to rails/sprockets#283
So it looks like the filenames are already using hex
I need to look into using The reported problem is coming from the cache blobs and not from filename digests. Still looking at where those are coming from. Maybe we could use hexdigest there too |
Just adding to the error report + possible temporary solution. My dev setup is a Debian box in Vagrant on Windows 7 host with winnfsd plugin for vagrant to simulate NFS. I'm getting the same error. Temporary solution for me is to explicitly set sprockets to version 3.5.2 in Gemfile. |
Note: this work does not include functionality for generating AnalysisJosItems. Note: Rolled back sprockets dependency due to rails/sprockets#283 Note: this commit merges the defunct analysis_controller into analysis_jobs_items_controller. This commit is a squash of a lot of work. - Initial work on making analysis job items - More work on analysis jobs items - Working on permissions - More work on analysis job items - Started adding routes and route specs. - Analysis job items: working on unit tests Routing was barely working. Lots of changes there. Also merged defunct analysis_controller into analysis_jobs_item controller. - Work on getting AnalysisJobsItemController to work. Also fixed routing tests. Simplified routing quite a bit by not routing to non-standard system_* actions. Part way through implementation and fixing of controller and acceptance tests. - Worked out how to fake analysis job items for system. Just need to get it to work 😉 - Almost fixed fake query, just need to get permissions to work and to re-enable fail in statustransition - working on getting the query right. worked out the problem: "sites"."id" = "audio_recordings_analysis_jobs_items"."site_id" doesn't work, site_id is NULL. Need to pull site_id from audio_recordings table - All but one test passes! yay! 😂 - Failing test fails because filter query builder doesn't know to use the system_query to form the base of the filter conditions. - All tests pass for AnalysisJobsItem CRUD - moved 'system' token to AnalysisJobsItem model - Created getter for analysis_job_id in AnalysisJobsItem model so that system token will be properly returned in API results - Added support for different filter settings for system results - Cleaned up controller. Refactored results_path and fixed a few related bugs - Updated analysis_jobs_items_results_spec tests - Ensure paths created for tests
I guess I don't know how we can be making file paths with upper and lowercase characters as hexdigest wouldn't allow it. Maybe something else is happening here? |
(from Schneems: This comment is not related to current ticket) I am using Rails 5.0.0. RC1 with sprockets 3.1.1 and have this same problem. Env. is Debian .. and there is no separate client.
On Debian there should be no issue with case conflicts .. I suppose the 2 char hash is broken. Cleaning the tmp seems to have fixed it for now -- but I am sure this is not the fix .. and I don't know enough but wasn't development mode supposed to be "raw" where everything is reloaded .. It seems not be the case anymore -- I guess the whole platform is so bloated now that it can't move without crutches :-) |
The behavior the original ticket describes was not in Sprockets 3.1.1 Can you open a new issue and give us an example app that reproduces the behavior. Also please try with the latest 3.6 version we won't apply patches against an older minor version of Sprockets. |
(from Schneems: This comment is not related to current ticket) Sorry, I didn't check this for the past 2 weeks This may be the wrong thread for this issue as it manifests on sprocket-rails -- though I believe that this cache issue is probably core sprocket and not rails specific. This week, I created a fresh VM with debian with 4.16 kernel and ruby 2.3 rails 5.0 + postgres and bootstrap and it is showing exactly the same behavior. Can you make a suggestion on creating an app -- on github? my new code is really small but the DB is 100MB and I don't have a test suit that you could use :-( |
Run Please quit responding on this thread, it is detracting from the original issue. |
Is there still an issue here with sprockets 4? |
I haven't upgraded to Sprockets 4 .. Our production schedule is very tight
and no upgrades are doable before Feb-2018.
If I see the problem I will report.
Sorry about the delay .
-SC
…On Fri, Nov 17, 2017 at 10:38 AM, Richard Schneeman < ***@***.***> wrote:
Is there still an issue here with sprockets 4?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#283 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGXe6qlNLLcFnAluL-uKWChWHavw6RNQks5s3aiPgaJpZM4IPmnE>
.
--
-satish
|
I'm seeing this issue as well when running inside Docker for MacOSX using Rails 5.2.0 and Sprockets 3.7.2. I cannot load any pages in development - I get the following error: Precompiling assets will temporarily resolve the issue, but this isn't a tractable solution for development work. If I backdate to an image that was based off of Rails 4.2, I don't have this problem. So there's something now with the combination of Rails 5 & sprockets 3.7 that is at fault. I updated to 3.7.2 because of CVE-2018-3760, so I can't backdate my version. My Gemfile.lock: https://github.com/broadinstitute/single_cell_portal_core/blob/development/Gemfile.lock Any suggestions? |
I'm seeing the exact same problem as @bistline with the same images. EDIT: Just found out I had some gems conflicting with each other in my Gemfile.lock file. I regenerated it and that solved my problem. |
Re: @bistline and others This is not only an issue with this particular gem, but I have seen issues with node packages and poorly-named imports as well. I dev on OS X, and to mitigate the problem, I created a new partition that is case-sensitive, journaled (it's actually one of the options when partitioning) and that seems to resolve the issues and prevent any future ones. This may not be applicable depending on IT restrictions (if it's a work computer) but I've found it to be a better overall solution as opposed to modifying app dependencies. In any case, I ran into this exact problem after doing a |
Same problem here, the issue seems to be introduced with v 3.6.0, downgrading to 3.5.2 seems to fix the issue. |
Like @Smolations commented, looks like this is related with how Windows manages filenames. Enabling case sensitivity on /tmp folder fixed the issue for me:
|
@nicwillemse literally also just stumbled onto this due to trying something out in Docker Desktop for Windows and the issue is that a base64 digest is case sensitive so all versions since 372301c could cause a conflict. However the namespace change in 3.6 greatly increases the chances of that occurring since it's just two characters. I'm working around the problem for now by mounting a docker volume as a custom cache path for Sprockets, e.g: # config/initializers/assets.rb
# Allow overriding of the sprockets cache path
Rails.application.config.assets.configure do |env|
env.cache = Sprockets::Cache::FileStore.new(
ENV.fetch("SPROCKETS_CACHE", "#{env.root}/tmp/cache/assets"),
Rails.application.config.assets.cache_limit,
env.logger
)
end # docker-compose.yml
web:
environment:
- BUNDLE_PATH=/bundle
- SPROCKETS_CACHE=/cache
volumes:
- .:/app
- bundle:/bundle
- cache:/cache
volumes:
bundle:
cache: Full commit here |
Thanks @pheuko - but this unfortunately will not work as the attributes are not inherited in the folder structure, see https://devblogs.microsoft.com/commandline/per-directory-case-sensitivity-and-wsl/ for more detail.
|
Thanks @pixeltrix - will give it a try, but looks to be a good solution. |
…prockets#283 - fsutil.exe file SetCaseSensitiveInfo C:\folder\path enable
@nicwillemse just updating here to note that Per-Directory Case Sensitivity for WSL has been improved to pass the attributes to newly created subdirectories. In my case I made a new local directory with the case sensitive attribute, then re-cloned my repo into it: mkdir case_sensitive_folder
setfattr -n system.wsl_case_sensitive -v 1 case_sensitive_folder
git clone git@github.com:myrepo case_sensitive_folder The solution from @pixeltrix is probably the better option for different or more containerized projects, but in my case the above solution was ideal.
|
Thank you for this fix, it works - but this is really putting a damper on my rails experience. Since this is going on for so long, wouldn't it at least be simple enough to rescue this error and ignore it? Since the folder already exists? I am also on Vagrant Ubuntu guest on a Windows host. Up until now, I symlinked my |
Sprockets weirds out on Windows, see rails/sprockets#283 (comment)
The changes introduced in bc40f15 add a namespace directory to the digest key.
Unfortunately, on Windows the namespace folder causes conflicts due to case sensitivity. For example:
lc
,Lc
,lC
all resolve to the same folder when creating the directory. When it comes time to resolve the asset in the folder the correct file cannot be found.Steps to reproduce:
tmp
folder for the application (a rails application in my case)thin start
in my case)/home/vagrant/baw-server/tmp/cache/assets/sprockets/v3.0/k5/k5Tf66eynpbdWEXajNU1EtcNgCTk8C201A0Vy-aBzgg.cache
This exception occurs:
It appears that when sprockets asked for the
K5
directory to be created, it returned with no side effect because the directory already existed (ask5
). Then when actually creating the file, theENOTDIR
error was raised because the directory didn't actually exist.Rolling back to version 3.5.2 fixes the issue for me.
I suspect similar problems may have been possible before the bc40f15 patch, however, such a large collision space (10^105) means the problem didn't occur. Once you account for case-insensitive operation, there's only 1,444 combinations available in a 2 character sequence.
Other details:
I'm using Vagrant
I've tried to isolate the problem by testing the following:
mkdir K5
also fails (does not create theK5
directory, does not error) in Ubuntumkdir.exe
fails in Windows withmkdir.exe: cannot create directory
K5': File exists`FileUtils.mkdir_p
on Ubuntu, in nfs mounted directory, gives (only one folder created and has casing from first command)FileUtils.mkdir_p
on Windows gives (only one folder created and has casing from first command)I'm not sure what the best solution is, but the only thing that comes to mind is to
downcase
the namespace before using it.The text was updated successfully, but these errors were encountered: