Download & Extend

user object not getting updated on user_save with memcache-session.inc

Project:Memcache API and Integration
Version:6.x-1.10
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:needs work

Issue Summary

If you enable memcache-session.inc, then visit the administration pages and click "Show descriptions" or "Hide descriptions", nothing happens. If you log out and log back in, then the change takes effect. This affects both the 6.x and 5.x versions.

Comments

#1

Yup, i can replicate this bug
Edit: I tested on the 6.x version.

#2

Title:Unable to show/hide descriptions on admin page with memcache-session.inc» user object not getting updated on user_save with memcache-session.inc
Version:5.x-1.x-dev» 6.x-1.x-dev

This bug also strikes if you try and edit your own user account. For example, edit your username and note that your user block's title doesn't change, still showing the old username.

When a user account is edited, or the show/hide descriptions link is clicked, the changes to the user are updated with a call to user_save(). However, user_save() does not update the global $user object, as it can be used to update the current user or a different user. In sess_write(), we update the 'users' cache table with the global $user object, and thus these changes are not saved in memory. You only see these changes if you log out and log back in, causing the 'users' cache entry for your user account to be rebuilt.

The attached patch modifies the user.module, which is obviously not the right way to do this. A better solution would be to create a module, perhaps memcache-session.module, and implementing hook_user(), flushing the appropriate users cache when 'after_update' is invoked. However, I'm hoping to get more eyes on this first. Thoughts?

#3

Attaching the patch...

AttachmentSize
memcache.patch 1.16 KB

#4

subscribe.

#5

Status:active» needs work

We could put a hook implementation in the new memcache.module, and check to see if we're using memache for sessions - if so clear the cache?

#6

Version:6.x-1.x-dev» 6.x-1.10
Priority:normal» major

This apparently is still an issue, because at least my site has this problem. I'm using user_save to update data in the data column. This updates the users table, but memcache never updates the global $user -variable. I'm using the latest stable module (6.x-1.10). I also have secure pages module installed and running, but there's no change whether it's on or off. I'm even tried using an extra "cache_clear_all" after I do a user_save, but to no avail.

Anyone have ideas on how to proceed or debug better?

I'm setting this to 'major' for now.

nobody click here