In the function location_user() (implementation of hook_user?) takes forever to execute, and sometimes times out my website. It tries to do hundreds of sql queries.
The funny thing is I don't even use locations for users. Only for nodes.

If I comment out the switch case 'load' my site works fine again.

Can you please put a way to turn off this user functionality completely?

I believe because I am user_loading a bunch of users for other purposes on some pages (in a node access module) - and location is adding extra queries FOR EACH USER that don't do anything for me.

Comments

JoaoJose’s picture

I believe I've came across this problem also.

What's happening is that function "location_load_locations" is loading all node location instances when you're not logged in (uid=0), causing the server to max out.

The trigger is the default value for the uid field on the location_instance table being 0 by which then you get a match if you are not logged in (uid=0).

Here is the change I made to location.module:

//line 1078 after "function location_load_locations($id, $key = 'vid') {"
//add

if ($key == 'uid' && $id == 0) {
return $locations;
}

Worked for me :-)

danielb’s picture

OK some further testing has revealed that the max exec was not caused soley by the location queries themselves, but by massive db_rewrites being done on those queries in another module - the developer of that module has since improved these.

I'm leaving this here because of JoaoJose's reponse and so bdragon can see this and decide if anything needs to be investigated further or not.

bdragon’s picture

Version: 6.x-3.0-rc2 » 6.x-3.x-dev
Status: Active » Fixed

I changed the loading code to return an empty set of locations when it gets called with an empty $id parameter.

http://drupal.org/cvs?commit=153838
http://drupal.org/cvs?commit=153841

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

bdragon’s picture

Title: site bogged - out of memory - max execution » site bogged - out of memory - max execution / Slow login with location enabled
Status: Closed (fixed) » Fixed

Bumping just because people are still hitting this one.
#343399: Location module cause "log in" process significantly slower marked duplicate.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Anonymous’s picture

Category: bug » support

When used in conjunction with the Gmap module,
continues to increase in the process of apache.