Closed (duplicate)
Project:
Boost
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Dec 2008 at 05:17 UTC
Updated:
20 Apr 2009 at 13:37 UTC
Jump to comment: Most recent file
Comments
Comment #1
alex s commentedsubscribing
Comment #2
alex s commentedRealization of this idea. Solves the problem with race condition.
Comment #3
alex s commentedComment #4
robloachThanks, Alex. I completely forgot about this issue.
Comment #5
pillarsdotnet commentedPatch does not work unless variable 'file_directory_path' is equal to '/cache' as per the mod_rewrite ruleset.
Spent a few hours chasing this down, grr!!!
Comment #6
mikeytown2 commented@pillarsdotnet
did you come up with a fix for the patch above or did you scrap this patch?
Comment #7
pillarsdotnet commentedI worked around it somehow.
Sorry I don't have details, but since then I've stopped using Boost because it has too many bugs that are affecting my customers.
Comment #8
robloachIf you're using Boost and would like it to be better, then use some of your customer time into fixing it ;-) .
Comment #9
rsvelko commentedI am the person here that hunts down red/pink issues and makes them green :) (Its just that I like green so much.)
In short: the patch above is wrong.
The problem here is as #5 says:
"
Patch does not work unless variable 'file_directory_path' is equal to '/cache' as per the mod_rewrite ruleset.
Spent a few hours chasing this down, grr!!!
"
So I guessed that http://api.drupal.org/api/function/file_save_data does sth unintuitive ... and after going through
http://api.drupal.org/api/function/file_move/6 -> http://api.drupal.org/api/function/file_copy/6 -> http://api.drupal.org/api/function/file_create_path/6 -> http://api.drupal.org/api/function/file_directory_path/6
it became clear that this func is meant for drupal managed files that users upload (or js/css caches)... it is not meant for general purpose file saving ...
So with a slight mod of http://api.drupal.org/api/function/file_save_data it should be fine .
But before writing the new func a question:
1. why was it necessary to replace file_put_contents - to remove the php4 compat func ? Or to remedy a race condition - what exactly - when would it come up?
2. is the proper place of boost cache in the sites/default/files ( file_directory_path - settable in core's settings ) - if so we can safely use the file_save_data API func and should document this and provide a notice/move func on update and .... you know make it work
Comment #10
mikeytown2 commentedLogic for the why is in here: http://api.drupal.org/api/function/file_create_path/6 if $dest doesn't contain the files dir or is a temp dir then it will return false. Only way I see of changing what file_directory_path returns is by changing the database variable. Bad idea. Marking this as won't fix because of that.
@rsvelko
I believe the main reason for this patch is for a possible race condition on a slow box, that all of a sudden gets a huge traffic spike. There will be multiple apache processes trying to write the static html file. Possible solution is flock().
Due to multisite installs, boost needs to stay out of the sites/default/files dir.
Comment #11
mikeytown2 commentedFound a related issue
#223610: Race condition in cache file creation
This conversation should move there, as I don't see a reasonable way of replacing file_put_contents() with file_save_data().
Comment #12
rsvelko commentedlets mark this as duplicate of the last one