Page MenuHomePhabricator

Quibble supervisord memcached confusion
Open, Needs TriagePublic

Description

Trying to reproduce a CI Selenium failure locally, I ran Quibble under docker. Many Selenium tests failed with login errors. Inspecting the screenshots and debug logs, I found that MW was trying to store sessions in memcached, but memcached was not running, leading to a "session loss" error.

I was following the instructions at https://doc.wikimedia.org/quibble/ but it didn't have the critical detail: the default entrypoint in the quibble docker images is now broken, and it's necessary to override it with --entrypoint=quibble-with-supervisord. Then supervisord will start memcached.

I don't understand why supervisord is needed at all. Quibble has its backend.py and does a reasonable job of managing MySQL and Chrome. Why not add memcached, php-fpm and Apache there?

Pretty much as soon as I manually started memcached, I hit a bug due to sharing of memcached data between one run and another. Memcached needs to have the same lifetime as MySQL.

It would be convenient for users of Quibble if it worked as documented and didn't require external services.

Event Timeline

The task which added Memcached is T300340. The issue is MediaWiki is configured to use Memcached whenever the extension is loaded regardless of whether a Memcached server is available.

The initial code was introduced by https://gerrit.wikimedia.org/r/c/integration/quibble/+/757844/5/quibble/mediawiki/local_settings.php.tpl and today looks like:

// Caching settings.
if ( extension_loaded( 'memcached' ) ) {
    $wgMainCacheType = CACHE_MEMCACHED;
    $wgMemCachedServers = [ '127.0.0.1:11211' ];
    $wgMemCachedPersistent = true;
}

It should probably only be configured when one uses quibble --memcached 127.0.0.1:11211 (and the CI job and/or quibble-with-supervisord should then do it).


The Quibble images should most probably default to use quibble-with-supervisord as an entrypoint. It takes care of spinning up backend services that can be used by different test suites.

I did not act on that task because on CI that is hardcoded to use quibble-with-supervisord as an entry point and frankly I forgot about it.

Introducing Supervisord was to have it drive Apache / php-fpm, support parallel requests and because it is faster than php -S T225218. It was not necessarily doable with Quibble backend.php, or maybe I haven't tried hard.

That definitely causes confusion to have two systems in parallel and @zeljkofilipin encountered the same issue when running Selenium tests, there were bunch of memcached errors because the image entrypoint invokes Quibble rather than supervisord.

So I guess a quick fix is to change the image entrypoint.

Memcached should probably be driven by Quibble itself and removed from Supervisord, that sounds easy to do.

Change #1251084 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/config@master] dockerfiles: quibble-bullseye: fix run as different user

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

Change #1251122 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/config@master] dockerfiles: quibble-bullseye: improve supervisord

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

Change #1277462 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/quibble@master] Fix semantic for Quibble injected PHP constants

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

Change #1277526 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/quibble@master] Add support to spawn Memcached as a backend

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

Change #1280257 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/config@master] dockerfiles: rebuild Quibble images for supervisord

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

Change #1251084 merged by jenkins-bot:

[integration/config@master] dockerfiles: quibble-bullseye: fix run as different user

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

Change #1251122 merged by jenkins-bot:

[integration/config@master] dockerfiles: quibble-bullseye: improve supervisord configuration

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

Change #1280257 merged by jenkins-bot:

[integration/config@master] dockerfiles: rebuild Quibble images for supervisord

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

Change #1280408 had a related patch set uploaded (by Hashar; author: Hashar):

[integration/config@master] jjb: update Quibble jobs for supervisord improvements

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

Change #1280408 merged by jenkins-bot:

[integration/config@master] jjb: update Quibble jobs for supervisord improvements

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

Change #1277462 merged by jenkins-bot:

[integration/quibble@master] Fix semantic for Quibble injected PHP constants

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

Change #1277526 merged by jenkins-bot:

[integration/quibble@master] Add support to spawn Memcached as a backend

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