Page MenuHomePhabricator

Cannot log in from MW1.35.8 or 1.35.6 with memcached (port number in $wgMemCachedServers changed from string to integer)
Closed, ResolvedPublic

Description

Hi All.

My MW 1.35.5 work fine with memcached as follows.

$wgMainCacheType = CACHE_MEMCACHED;
$wgParserCacheType = CACHE_MEMCACHED;
$wgMessageCacheType = CACHE_MEMCACHED;
$wgSessionCacheType = CACHE_MEMCACHED;
$wgMemCachedServers = array("unix:///var/run/memcached/memcached.sock:0");
$wgSessionsInMemcached = true; # optional
$wgSessionsInObjectCache = true; # optional

And tried to upgrade to latest of series 1.35 (1.35.8) but got error as follow

LogicException: Process cache for 'en' should be set by now

I had been report at task of https://phabricator.wikimedia.org/T258860 using MW 1.35.6.

Upgrade success when disable message cache as follows.

$wgMessageCacheType = CACHE_NONE;

Work fine look like until try to logging in as follows.

There seems to be a problem with your login session; this action has been canceled as a precaution against session hijacking. Please resubmit the form.

Login success when disable cache completed as follows.

$wgMainCacheType = CACHE_NONE;
$wgParserCacheType = CACHE_NONE;
$wgMessageCacheType = CACHE_NONE;
$wgSessionCacheType = CACHE_NONE;
# $wgMemCachedServers = array("unix:///var/run/memcached/memcached.sock:0");
$wgSessionsInMemcached = false; # optional
$wgSessionsInObjectCache = false; # optional

Please help to debug.
Thanks a lot.

Event Timeline

taavi triaged this task as High priority.Oct 13 2022, 10:44 AM
taavi added subscribers: Paladox, Krinkle, taavi.

I'm seeing this too when upgrading from 1.35.5 to 1.39~rc.1. T298564: Add support for using ipv6 address for memcached ships in 1.35.6 (and other recent maintenance releases). My config looks like this:

$wgMainCacheType = CACHE_MEMCACHED;
$wgSessionCacheType = CACHE_MEMCACHED;

$wgMemCachedServers = [
	'mediawiki-memcached.<redacted>:11211',
];

/cc @Paladox @Krinkle as the authors and +2'ers of the original patch.

At least the unix socket breakage seems to explained by the patch I linked above:

// old
>>> preg_split( '/:(?=\d)/', 'unix:///var/run/memcached/memcached.sock:0' );
=> [
     "unix:///var/run/memcached/memcached.sock",
     "0",
   ]

// new
>>> \Wikimedia\IPUtils::splitHostAndPort( 'unix:///var/run/memcached/memcached.sock:0' );
=> false

Not sure if it fully explains the errors I'm seeing with the hostname setup but the old regex based method returns ports as strings while IPUtils converts them to integers.

>>> preg_split( '/:(?=\d)/', 'memcached.example.org:11211' );
=> [
     "memcached.example.org",
     "11211",
   ]

>>> \Wikimedia\IPUtils::splitHostAndPort( 'memcached.example.org:11211' );
=> [
     "memcached.example.org",
     11211,
   ]
Epopen closed this task as Resolved.EditedOct 14 2022, 3:07 AM
Epopen claimed this task.

At least the unix socket breakage seems to explained by the patch I linked above:

// old
>>> preg_split( '/:(?=\d)/', 'unix:///var/run/memcached/memcached.sock:0' );
=> [
     "unix:///var/run/memcached/memcached.sock",
     "0",
   ]

// new
>>> \Wikimedia\IPUtils::splitHostAndPort( 'unix:///var/run/memcached/memcached.sock:0' );
=> false

Not sure if it fully explains the errors I'm seeing with the hostname setup but the old regex based method returns ports as strings while IPUtils converts them to integers.

>>> preg_split( '/:(?=\d)/', 'memcached.example.org:11211' );
=> [
     "memcached.example.org",
     "11211",
   ]

>>> \Wikimedia\IPUtils::splitHostAndPort( 'memcached.example.org:11211' );
=> [
     "memcached.example.org",
     11211,
   ]

Hi @taavi

Your analyzed the patch is correct , root cause and solution of my issue.
My new config as follows.

$wgMemCachedServers = ['localhost:11211',];

The issue fixed, version update successful and work fine.
Thanks you very much.

Aklapper renamed this task from Cannot log in from MW1.35.8 or 1.35.6 with memcached. to Cannot log in from MW1.35.8 or 1.35.6 with memcached (port number in $wgMemCachedServers changed from string to integer).Oct 14 2022, 8:58 AM
Aklapper removed Epopen as the assignee of this task.