When clearing the cache with Drush, I repeatedly keep seeing this error.
GMap is unable to save the marker bundle, so the markers will not work. Please check file system permissions of the public://js/gmap_markers.js!
.
I checked the permissions for over a dozen times just to make sure it's not me, but they are good. The same as all other files on public:// and those settings work.
Also I seems that every entity with a map attached to it, loads terribly slow. Some Views pages with event nodes on them take for over a minute (used to be 2-3 seconds). Something since 2.10 that could have caused this?
I deliberately did not post this in #2282939: SLOW loading a GMAP page because this issue appeared only after updating from 2.10 and as such cannot be related to the other issue (reported under 2.9).
| Comment | File | Size | Author |
|---|---|---|---|
| #52 | gmap-7.x-2.x-2693297-52-revert-gmap-regen.patch | 1.07 KB | frodri |
| #35 | gmap-7.x-2.x-2693297-35-gmap_markers-permission-problems.patch | 316 bytes | donquixote |
| #13 | gmap_unable_save_marker_bundle_2693297-13.patch | 535 bytes | betz |
| #10 | gmap_unable_save_marker_bundle_2693297-10.patch | 627 bytes | jackalope |
Issue fork gmap-2693297
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
neograph734Comment #3
neograph734It looks like this commit in #2571855: Unlock gmap_regenerate_markers in cli mode is the only thing that can be related to this.
Comment #4
neograph734It appeared the reduced speed was the cause of a failing hard drive. The write error remains though.
Comment #5
coolestdude1 commentedSame issue for me, nginx - php-fpm - php5.6.
I have gone as far as checking /includes/file.inc and adding debug statements to the following function to see what was going on here is what I found.
In function: file_prepare_directory
If you add debugs to what is the directory and components being checked you will see firstly a check for 'public://js/' is writable, then another call to this function and the second time through it checks 'public://js', for some reason the newer version of gmap is checking if the folder is writable then checking to see if this 'js' file would be writable which seems very fishy to me.
I am not sure what in the latest update to gmap is causing this because in the old version it works to save the file just fine and not much of the code around this section has changed.
Comment #6
neograph734All calls to file_prepare_directory I've found do not include the leading slash in the path.
In above code you'll see that the path does include a leading slash, that gets fed into file_prepare_directory(). It might work better if we'd change that into:
I can test and patch this after the weekend.
Comment #7
johnvThe info in the following (closed) issues might help:
#1114164-72: Stop clearing markers so often: fixes Message: GMap is unable to save the marker bundle. Markers will not work!
#1167594-13: Saving gmap_markers.js needs catch errors
Try setting the file permissions to 777. The drush user is not the website user.
You can also try the link on : /admin/config/services/gmap
Comment #8
arruk commented#7 worked for me. Specifically the directory js in /sites/default/files/ needs to be set to 777 for some reason...
Comment #9
neograph734I suppose the advice to make any folder in your files directory writeable by everybody is generally bad practice. It should be writeable for your webserver and nobody else.
Source The files directory
So I suppose it would be better to always have Drush ran by the webserver (rather than the ssh user you are using by default). http://drupal.stackexchange.com/questions/51436/drush-and-user-permissions explains you can do something like this:
sudo -u apache drushor on debian/ubuntu:
sudo -u www-data drushMight not be the best advice, but IMHO better then setting 777 on the files directory or a sub-directory.
And since this is a Drush / filesystem issue, I suppose this question should be closed as there is obviously nothing this module can do to change that.
Comment #10
jackalope commentedThis problem has been around for a while in the Gmap module. This patch in an earlier issue about the problem has the right idea, but the patch no longer applies properly to gmap.module.
I've attached a new patch here that applies cleanly to Gmap 7.x-2.11 (let's see how it tests against 7.x-2.x-dev!
Comment #12
mustanggb commentedPatch works perfectly, just needs to be rerolled from the module directory.
Comment #13
betz commentedpatch rerolled, let's continue :)
Comment #14
betz commentedComment #16
jackalope commentedThanks so much for the reroll--I know it sounds silly but I honestly hadn't been able to find the time myself!
I see the rerolled patch is still failing testing though; will try to give it a look soon...ish.
Comment #17
neograph734Patches need to be built and tested against the latest development version. Let's see how it performs there.
Comment #19
neograph734It seems the development branch is broken, but not marked as such. The same test fails on all commits. This has been spotted here as well.
I have requested an issue with the Drupal.org infra team, maybe they can queue the development branch for re-testing. #2778705: Requesting a branch re-test of the gmap module
Comment #20
neograph734It seems we'd have to take care of #2778721: [Patch Blocker] - Repair the failing testGmapSaveConfig test first.
Comment #21
neograph734The patch has been queued for re-testing as soon as the -dev branch is passing.
Comment #22
ahimsauziI have been getting this same error locally when my /tmp directory was not set up properly after bringing down remote db. Hope this helps.
Comment #23
mustanggb commentedTests are passing and it fixes the Drush issue.
Comment #24
Chris CharltonComment #25
asiby commentedThe patched worked for me. Kudos to everyone who contributed.
Comment #26
Eric Bouquerel commentedthis patch https://www.drupal.org/files/issues/gmap_unable_save_marker_bundle_26932... solved it for me, thank you.
Comment #27
ikeigenwijs commentedpleas get this committed to dev
Comment #28
rakun commentedAfter patch https://www.drupal.org/files/issues/gmap_unable_save_marker_bundle_26932... I still get error message in watchdog "The file permissions could not be set on public://js/gmap_markers.js.". GMap module 7.x-2.11.
Comment #29
mustanggb commented@rakun
It could be that your permissions are infact not set correctly, this patch is for people that have set their permissions correctly, but still have the message.
Comment #30
p4trizio commentedPatch #13 is working, I guess it's time to commit
Comment #31
Chris Charlton+1
Comment #32
joegl commentedI've done EVERYTHING I could to fix this issue, after an upgrade from 2.9 to 2.11. I then found this StackOverflow comment: https://drupal.stackexchange.com/questions/97623/how-to-add-a-custom-mar...
After getting the permissions resolved this is what finally actually did it for me.
Comment #33
donquixote commentedI think we should only commit a patch that fixes both this and #1978520: The file permissions could not be set on public://js/gmap_markers.js, in a way that you can clear the cache in drush/cli and in web without any warnings related to gmap_markers.js.
Problems with patch #13:
It does not solve the fundamental problem that a file or directory can either be owned by drush/cli user or by web user (www-data), not by both. Hence, you will get the "The file permissions could not be set on public://js/gmap_markers.js" either in drush cc all or in when flushing caches with the browser.
It changes the
$filepathvariable, but then this variable is not used anywhere (except in messages).The file_save_data() call uses a hardcoded file path.
If we WERE to use the modified $filepath variable there, it would cause problems:
/path/to/drupal/sites/default/files/jsgmap_markers.js.And finally, no one in this issue has so far explained which underlying problem is fixed by calling drupal_realpath().
Perhaps there is a good reason, but it deserves to be explained.
Comment #34
donquixote commented@MustangGB (#29)
The "correct" permissions would be:
- File and directory owned by web user and group (www-data:www-data)
- For the sake of argument, let's give it directory and file 777.
With these permissions and ownership,
drush cc allstill produces errors from drupal_chmod(), unless you run drush as the web user (on Linux). Even with permission 777, Linux only allows the file owner to change permissions.Comment #35
donquixote commentedLet's try a different approach.
Unsetting the 'gmap_marker_file' variable on flush cache will cause the markers to be rebuilt next time they are needed, but not immediately.
Most likely, this "next time they are needed" will be from a web user.
Testing instructions:
Preparation:
- Make sure that everything in sites/default/files is owned by web user, e.g. www-data.
Testing steps, in random order:
- Run
drush cc allon cli- Flush caches via the UI, in random order.
- Visit a page with a gmap.
- Regenerate marker cache on admin/config/services/gmap.
- Delete the file sites/default/files/js/gmap_markers.js, and try the above again.
- Delete the directory sites/default/files/js, and try the above again.
Comment #36
liam morlandPerhaps it should delete the file as well.
Comment #37
rblau06 commentedApplying the patch and following the steps in #35 worked for me - thank you!
Comment #38
cprofessionals commentedConfirmed #35 worked here as well.
Comment #39
crutch commented+1 #35 - Thanks
Comment #40
ikeigenwijs commented#35 ++ seems to work
Comment #41
jmev commentedI applied patch #35 and also set perms to 777 for the sites/default/files directory and that helped. Thanks, donquixote for all your work.
Comment #42
solideogloria commentedComment #44
podarokthnx, merged #35
Comment #45
the_g_bomb commentedI don't think the correct patch was commited unfortunately.
The patch commited does not fix the issue, it's just a workaround to stop the markers being regenerated during a cache clear. Now, I suspect, the only way to regenerate the markers is to log into the site and go to admin/config/services/gmap.
This patch also just deletes the gmap_marker_file variable, but leaves the file in place, so it's not even a full solution IMHO.
I think this should remain in needs work until the issue of markers being able to be regenerated by cron, drush and also through the UI is fixed.
Comment #47
the_g_bomb commentedI think Neograph734 had it early on, but it doesn't look like a patch was ever produced.
https://www.drupal.org/project/gmap/issues/2693297#comment-11009209
The check for the directory has been failing before the file was attempted to be saved. I think while the trailing slash should have been trimmed, it doesn't look like it was before the check was made.
Comment #49
podarokComment #50
the_g_bomb commentedHi, could this be backported to 7.x-2.x as well please?
Comment #52
frodri commented7.x-2.x backport of https://git.drupalcode.org/project/gmap/-/merge_requests/3/diffs attached.