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

andreiashu’s picture

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

jeremy’s picture

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?

jeremy’s picture

StatusFileSize
new1.16 KB

Attaching the patch...

Taras_’s picture

subscribe.

catch’s picture

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?

afox’s picture

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.

gnindl’s picture

Status: Needs work » Needs review
StatusFileSize
new995 bytes

I noticed this as well as our site. The user object cached with memcache doesn't seem to be updated, e. g. changed roles, permissions etc. are not reflected. I ported the patch from commetn #3 and implemented a hook in memcache.module. In order to get it working you have to enable the memcache module.

timtrinidad’s picture

The fix outlined in #7 (and #3) appears to have been committed to the module on September 2010 and is in the current version of the module (6.x-10):

http://drupalcode.org/project/memcache.git/commitdiff/2db1f6762359af8c30...

If you're still experiencing this issue, it may be caused by something else.

damienmckenna’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Drupal 6 has not been supported for a long time.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.