I am using GMap and markers disappear each time a scheduled cron job is executed (once every hour). The maps show up but no markers then. In order to have them back, I have to manually click the Regenerate marker button and they reappear. Any idea what is wrong?

I'm using Drupal 6.12
CCK: 6.x-2.x-dev
Views: 6.x-2.5

Thanks!

Comments

manero24’s picture

Assigned: manero24 » Unassigned

I am using GMap and markers disappear each time a scheduled cron job is executed (once every hour). The maps show up but no markers then. In order to have them back, I have to manually click the Regenerate marker button and they reappear. Any idea what is wrong?

I'm using Drupal 6.12
CCK: 6.x-2.x-dev
Views: 6.x-2.5

Any idea?

bbence’s picture

Component: Miscellaneous » Code
Category: support » bug

I'm having the same problem. For me the Regeneration doesn't solve the problem. The only way to get back the markers is to go through each node and resave them. When I resave a node with a marker (by the way I'm using a gmap views and displaying the markers based on taxonomy), the whole gmap displays the same marker. Only after saving every node with a different marker I get back the correct marker display (correct marker for each taxonomy term).
So again, the cron ruins the markers for me as well.

nathaniel’s picture

Looking for a solution to this...

When cron runs I get these error msg.
The directory sites/default/files/js is not writable, because it does not have the correct permissions set.

The selected file /tmp/fileC6eByR could not be uploaded, because the destination sites/default/files/js/gmap_markers.js could not be found, or because its permissions do not allow the file to be written.

nathaniel’s picture

Okay, I changed the folder permissions http://drupal.org/node/365062

and added/enabled the Clusterer2.js marker manager...

It has been working since last night and cron runs every hour.

nathaniel’s picture

Well, I lied. That didn't really work.

Trying another angle and adding this function to the end of cron.php:

gmap_regenerate_markers();

pmonjo’s picture

Hi Nathaniel,

Have you had any luck with your latest approach? I am having exactly this issue.

Thanks!

Pedro

nathaniel’s picture

No luck with the above...

I updated to the latest dev version.

Then there was an error in the logs indicating that the marker path was invalid. It was returning the base url and base path for some reason, so I changed a line of code and it seems to be working fine now.

Around 504 ~

replaced base_path() with '/'

<?php

  $contents .= "Drupal.gmap.iconpath = ". drupal_to_js('/'.variable_get('gmap_markerfiles', drupal_get_path('module', 'gmap') .'/markers')) .";\n";

?>
bbence’s picture

It seems now to me that at least in my case, the markers get messed up when I'm clearing the cache. Coriously enough, it only happens when I clear the cache with the standard cache clearing button but not when I'm clicking the "Regenerate marker cache" of the admin page. But according to the code, in both cases the gmap_regenerate_markers function is called. I tried chaging several things here but I couldn't get it to work. So basically my issue is the following:

1. Whenever the cache is cleared, all my markers on gmap are reset to the default marker
2. If I go into editing one of the nodes and resave the node without changes, curiously the markers of that node appears and all the other nodes will get this marker, even though they should have a different marker
3. I'm using taxonomy markers and I resave all my nodes, it works until the drupal cache clearing is called
4. When the case of disappearing markers happen, if I set a default marker in my gmap Views, it gets displayed. So it seems that the markers associated with the taxonomy term cannot be found
5. But also the markers disappear not only for the gmap Views display, but also for the gmap block.

Any ideas?

Thanks!
Bence

nirad’s picture

FWIW, this started happening to me after I moved my development site to a new computer. Both computers run Windows with WAMP. The new environment was running WAMP with PHP 5.3, but I had problems with 5.3 and Gmap (see: http://drupal.org/node/582934), so I downgraded to PHP 5.2.11. But I still have this problem with the taxonomy markers not showing up. I will try my development sites in different environments to see what works.

dpatte’s picture

I had markers working then enabled cron on my site. Now markers are missing, though it does zoom in to the right location.
Regenerate markers doesnt seem to work for me though. Ideas?

dpatte’s picture

To add more detail, I had a test system running than over a 1 day period i made the following changes:

- i enabled cron
- i upgraded pathauto to the latest version
- i upgraded fivestar to the latest version

Some time during that period, markers disappeared.

dpatte’s picture

I noticed that my log file contains the following each 15 minutes since about the time i enabled cron:

[23-Oct-2009 22:00:02] PHP Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent

presumably cron is having a problem that also showed up at the same time as my marker problem, and may be another sympton.

The first time that it got this error, it also got the following error:

[23-Oct-2009 08:30:12] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 75 bytes) in (my path)/sites/all/modules/gmap/gmap_markerinfo.inc on line 201

Is it possible that some cache file is corrupted? Which cache files should I clean out?

dpatte’s picture

my cache settings are all disabled - but i decided to clear my cache anyway (admin/settings/performance) . lo and behold - my markers have all returned.
They have survive a cron run since then as well, but i still get cron errors.

nathaniel’s picture

Looks like it is a caching issue and file permissions.

In the end disabling optimize javascript files in site performance and clearing cache fixes the problem.

Or change file permissions if you want / have optimize javascript files enabled.

chmod 775 files/js and add apache as the owner or group...

dpatte’s picture

I dont see this problem anymore, and I believe I had a problem with cron (it was running out of memory). After fixing my cron memory problem, I have not seen this this problem again.

pmonjo’s picture

I think that I have found the reason for this bug, at least in my case. Let me try to explain it.

I am running Drupal cron using the command "/path/to/drupal/scritps/drupal.sh --root /path/to/drupal". This sets the base_path to '/path/to/drupal'. Therefore, in function gmap_regenerate_markers() (in gmap.module, line 496), when recreating the markers cache, the parameter "Drupal.gmap.iconpath" is set to "/path/to/drupal/sites/all/files/js/gmap_markers.js" instead of "/sites/all/files/js/gmap_markers.js".

Running Drupal cron using curl, solves the problem.

Can this be considered a bug in drupal.sh or somewhere else?

ben_scott’s picture

Hi -

I was having the same problem & it seems like it's a bug in drupal.sh. There's a patch for a similar issue at http://drupal.org/node/415064 - and it also fixes this gmap bug.

Cheers,

Ben

jkraneis’s picture

For me setting the Base URL in the settings.php file solved the problem. After that, the path in the cron-regenerated marker cache was right.

Cheers,

Jan

guillaumeg2’s picture

Jan -> Same for me ! It works !

so4’s picture

Thanks Jan. Base URL worked for me.

FreekyMage’s picture

We had a problem with mobile-tools when using this $base_url sollution and it didn't switch theme anymore when on the mobile version on the site. We copied the code that drupal uses to build the url and put it in settings.php and mobile-tools and gmap both worked correctly. So try to use this if you have any problems:

$base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
$base_url = $base_root .= '://'. $_SERVER['HTTP_HOST'];
rooby’s picture

Status: Active » Postponed (maintainer needs more info)

Are people still seeing this with the latest version?

It definitely seems like a file permissions problem in a lot of cases.

james marks’s picture

Comment #18 solved it for me.

Discovered that gmap markers were disappearing from Google maps. Found that 'iconpath' value in 'gmap_markers.js' file was being set to absolute path rather than relative path on cron. Googled problem and found this issue. Examined 'settings.php' file and discovered that '$base_url' had been commented out. Restored '$base_url' definition and problem was resolved.