Last modified: 2014-01-29 02:55:59 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57986, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55986 - RedisBagOStuff->incr broken by due to PHP serialization for primitives
RedisBagOStuff->incr broken by due to PHP serialization for primitives
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.22.0
All All
: Normal normal (vote)
: ---
Assigned To: Matthew Flaschen
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-22 06:18 UTC by Matthew Flaschen
Modified: 2014-01-29 02:55 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Matthew Flaschen 2013-10-22 06:18:10 UTC
This can be reproduced by running:

php /vagrant/mediawiki/tests/phpunit/phpunit.php --use-bagostuff=redis /vagrant/mediawiki/tests/phpunit/includes/objectcache/BagOStuffTest.php

on https://gerrit.wikimedia.org/r/#/c/91138/ .

I was able to eliminate the error by dropping RedisBagOStuff->incr (falling back on the parent's incr, lock, and unlock), but I'm not sure if that's an acceptable solution.

This breaks the ping limiter (tested), and probably a couple other things (not tested), when Redis is the main cache (as it is with MediaWiki-Vagrant).
Comment 1 Matthew Flaschen 2013-10-22 06:20:21 UTC
The reason it doesn't work is that the value gets written as e.g. "i:0;", and Redis can't increment that.
Comment 2 Tyler Romeo 2013-10-22 06:30:17 UTC
I don't think this is a bug with MediaWiki, because the RedisBagOStuff class does not do any serializing. That is handled by the underlying phpredis library. Then again, I don't have much experience with Redis, so I could be wrong.
Comment 3 Matthew Flaschen 2013-10-22 06:30:43 UTC
To clarify, by "This breaks", I mean master, not the proposed fix (using the parent's).
Comment 4 Matthew Flaschen 2013-10-22 06:32:13 UTC
It's a bug with how MW uses Redis and the libraries.  We specifically request to use the PHP serializer *and* use Redis's INCR call (which does the increment on the server, rather than the client sending the new value); that's the conflict.

See https://git.wikimedia.org/blob/mediawiki%2Fcore.git/d987f43b24a24a6f3fcd5886fedaf483fa3c6891/includes%2Fobjectcache%2FRedisBagOStuff.php#L58 and https://git.wikimedia.org/blob/mediawiki%2Fcore.git/d987f43b24a24a6f3fcd5886fedaf483fa3c6891/includes%2Fobjectcache%2FRedisBagOStuff.php#L297
Comment 5 Gerrit Notification Bot 2013-10-22 21:37:51 UTC
Change 91296 had a related patch set uploaded by Mattflaschen:
Fix Redis increment behavior

https://gerrit.wikimedia.org/r/91296
Comment 6 Gerrit Notification Bot 2013-10-22 23:49:03 UTC
Change 91296 merged by jenkins-bot:
Fix Redis increment behavior by using BagOStuff->incr instead

https://gerrit.wikimedia.org/r/91296

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links