Page MenuHomePhabricator

CX beta-feature does not stay enabled
Closed, ResolvedPublic1 Story Points

Description

If the user selects to 'Try Content Translation' from the campaign, the dashboard is displayed. However, the beta-feature does not stay enabled and if the user visits Special:CX then they are shown the 'no such page' error.

Event Timeline

Arrbee created this task.Mar 10 2015, 6:39 AM
Arrbee claimed this task.
Arrbee removed Arrbee as the assignee of this task.
Arrbee raised the priority of this task from to Normal.
Arrbee updated the task description. (Show Details)
Arrbee set Security to None.
Arrbee added subscribers: Amire80, Arrbee, santhosh and 5 others.

Works on my local wiki. When the dashboard opens, do you see "CX beta feature was enabled on this wiki" popup near the personal toolbar?

Can you give an url to the wiki where you see this problem?

Arrbee added a project: LE-Sprint-84.
Arrbee moved this task from Backlog to Sprint 84 on the ContentTranslation-Release4 board.

Can you give an url to the wiki where you see this problem?

http://en.wikipedia.beta.wmflabs.org/w/index.php?title=Special:ContentTranslation for sure. @santhosh has also been having the same difference in result between local instance and beta-labs. I am beginning to wonder if there is a different configuration on that wiki thats getting in the way here.

KartikMistry added a comment.EditedMar 18 2015, 7:29 AM

Confirmed. After enabling Beta feature via Campaign, it doesn't reflect in DB too.

mysql> select user_id from user where user_name = 'KartikMistry';
+---------+
| user_id |
+---------+
|     973 |
+---------+
1 row in set (0.00 sec)

mysql> select * from enwiki.user_properties where up_property = 'cx' AND up_user = '973';
+---------+-------------+----------+
| up_user | up_property | up_value |
+---------+-------------+----------+
|     973 | cx          | 0        |
+---------+-------------+----------+
1 row in set (0.00 sec)
Arrbee moved this task from Backlog to In Progress on the LE-Sprint-84 board.Mar 18 2015, 7:30 AM
Nikerabbit renamed this task from CX beta-feature does not stay enabled for the logged-in user to CX beta-feature does not stay enabled in http://en.wikipedia.beta.wmflabs.org/.Mar 18 2015, 9:04 AM
Nikerabbit edited a custom field.

In my testing, cx will be set to 1 when I arrive on Special:CX, however when I load Special:Preferences it is reverted back to 0 in the database.

Heavily summarized binlog output:

## Me loading Special:CX with a campaign, it calls saveSettings()
#150318  9:47:09
UPDATE /* User::saveSettings Nikerabbit */  `user` SET user_name = 'Nikerabbit',[XXX] WHERE user_id = '3609'

## saveSettings calls saveOptions, but that deletes the property instead of setting it to 1?
#150318  9:47:09
DELETE /* User::saveOptions Nikerabbit */ FROM `user_properties` WHERE up_user = '3609' AND up_property = 'cx'

## saveSettings then reinserts the option with bunch of other stuff
#150318  9:47:09
INSERT /* User::saveOptions Nikerabbit */ IGNORE INTO `user_properties` (up_user,up_property,up_value) VALUES ('3609','visualeditor-enable','1'),('3609','visualeditor-hidebetawelcome','1'),('3609','betafeatures-popup-disable','1'),('3609','betafeatures-vector-compact-personal-bar','1'),('3609','betafeatures-vector-fixedheader','0'),('3609','cx','1'),('3609','popups','0'),('3609','timecorrection','Offset|0'),('3609','uls-compact-links','0'),('3609','watchlisttoken','fa8d459584a81afc603ce2a9d58d970bffc1e57a'),('3609','wikibase-otherprojects','0')
COMMIT

## me loading Special:Preferences, basically same as above but cx is set to 0 in last INSERT
#150318  9:47:15
UPDATE /* User::saveSettings Nikerabbit */  `user` SET user_name = 'Nikerabbit',[XXX] WHERE user_id = '3609'

#150318  9:47:15
DELETE /* User::saveOptions Nikerabbit */ FROM `user_properties` WHERE up_user = '3609' AND up_property = 'cx'

#150318  9:47:15
INSERT /* User::saveOptions Nikerabbit */ IGNORE INTO `user_properties` (up_user,up_property,up_value) VALUES ('3609','visualeditor-enable','1'),('3609','visualeditor-hidebetawelcome','1'),('3609','betafeatures-popup-disable','1'),('3609','betafeatures-vector-compact-personal-bar','1'),('3609','betafeatures-vector-fixedheader','0'),('3609','cx','0'),('3609','popups','0'),('3609','timecorrection','Offset|0'),('3609','uls-compact-links','0'),('3609','watchlisttoken','fa8d459584a81afc603ce2a9d58d970bffc1e57a'),('3609','wikibase-otherprojects','0')
COMMIT

First I thought it would be related to $wgDefaultUserOptions and things missing form it getting deleted, but I don't think that is the case. It looks like something is explicitly setting cx = 0 OR loading a stale value and then calling saveSettings() when accessing Special:Preferences

On my local wiki User::saveOptions is accessed each time Special:Preferences is accessed (also when not changing anything) by BetaFeatures: SpecialPreferences::execute/Preferences::getFormObject/Preferences::getPreferences/Hooks::run/call_user_func_array/BetaFeaturesHooks::getPreferences/User::saveSettings

BetaFeaturesHooks::getPreferences only ever calls setOption with value '1', so it cannot set anything back to '0'. This and the fact that it does not happen on my local wiki leads me to a conclusion that stale data is loaded and then saved.

Nikerabbit raised the priority of this task from Normal to High.Mar 18 2015, 10:41 AM

This is still a problem. Even if I enable CX from the campaign it doesn't get activated for a little while and causes confusion by displaying the beta-feature as initially disabled and then automatically enabled.

Steps to reproduce:

  1. Check CX is disabled
  2. Try creating a new page and confirm the campaign is visible
  3. Click on campaign blue button to enable CX
  4. From Special:CX click on Preferences or beta link and check the status of CX. It shows 'disabled'
  5. Special:CX will show 'no such page'
  6. Reload Special:Preferences and check the status of CX. It shows 'enabled' without any intermediate action from the user
  7. Special:CX is visible

Similar thing is happening on production as well.

greg renamed this task from CX beta-feature does not stay enabled in http://en.wikipedia.beta.wmflabs.org/ to CX beta-feature does not stay enabled.Mar 19 2015, 5:18 PM
greg removed a project: Beta-Cluster-Infrastructure.
Nikerabbit moved this task from In Progress to Blocked on the LE-Sprint-84 board.Mar 23 2015, 12:36 PM

User::saveSettings() should be invalidating the memcache cache of information via a call to User::clearSharedCache(). Once that is done, the next request that touches the User object should fetch from the database and repopulate memcache. If the requests are close enough together there may be a race with master->slave database replication that allows the older information to be fetched from the slave before it receives the update from the master.

Change 198760 had a related patch set uploaded (by Nikerabbit):
Re-populate shared cached after saving settings

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

Nikerabbit added a subscriber: KartikMistry.

Change 199554 had a related patch set uploaded (by Aaron Schulz):
Made user preferences load from the master

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

Change 199554 merged by jenkins-bot:
Made user preferences load from the master by default

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

Nikerabbit closed this task as Resolved.Mar 31 2015, 10:30 AM

Based on our testing on deployment-prep this issue has been fixed. We will test on production as well once the patches are there.

Change 198760 abandoned by Aaron Schulz:
Re-populate shared cache after saving settings

Reason:
AFAIK no, closing

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

Change 201131 had a related patch set uploaded (by KartikMistry):
Made user preferences load from the master by default

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

Pginer-WMF moved this task from Backlog to Done on the LE-Sprint-85 board.Apr 1 2015, 8:23 AM

Change 201131 merged by jenkins-bot:
Made user preferences load from the master by default

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

aaron added a subscriber: aaron.Apr 7 2015, 9:49 PM

Is it known what is calling saveSettings() to do nothing just be visiting Special:Preferences?

Heavily summarized binlog output:

## Me loading Special:CX with a campaign, it calls saveSettings()
#150318  9:47:09
UPDATE /* User::saveSettings Nikerabbit */  `user` SET user_name = 'Nikerabbit',[XXX] WHERE user_id = '3609'
## saveSettings calls saveOptions, but that deletes the property instead of setting it to 1?
#150318  9:47:09
DELETE /* User::saveOptions Nikerabbit */ FROM `user_properties` WHERE up_user = '3609' AND up_property = 'cx'
## saveSettings then reinserts the option with bunch of other stuff
#150318  9:47:09
INSERT /* User::saveOptions Nikerabbit */ IGNORE INTO `user_properties` (up_user,up_property,up_value) VALUES ('3609','visualeditor-enable','1'),('3609','visualeditor-hidebetawelcome','1'),('3609','betafeatures-popup-disable','1'),('3609','betafeatures-vector-compact-personal-bar','1'),('3609','betafeatures-vector-fixedheader','0'),('3609','cx','1'),('3609','popups','0'),('3609','timecorrection','Offset|0'),('3609','uls-compact-links','0'),('3609','watchlisttoken','fa8d459584a81afc603ce2a9d58d970bffc1e57a'),('3609','wikibase-otherprojects','0')
COMMIT
## me loading Special:Preferences, basically same as above but cx is set to 0 in last INSERT
#150318  9:47:15
UPDATE /* User::saveSettings Nikerabbit */  `user` SET user_name = 'Nikerabbit',[XXX] WHERE user_id = '3609'
#150318  9:47:15
DELETE /* User::saveOptions Nikerabbit */ FROM `user_properties` WHERE up_user = '3609' AND up_property = 'cx'
#150318  9:47:15
INSERT /* User::saveOptions Nikerabbit */ IGNORE INTO `user_properties` (up_user,up_property,up_value) VALUES ('3609','visualeditor-enable','1'),('3609','visualeditor-hidebetawelcome','1'),('3609','betafeatures-popup-disable','1'),('3609','betafeatures-vector-compact-personal-bar','1'),('3609','betafeatures-vector-fixedheader','0'),('3609','cx','0'),('3609','popups','0'),('3609','timecorrection','Offset|0'),('3609','uls-compact-links','0'),('3609','watchlisttoken','fa8d459584a81afc603ce2a9d58d970bffc1e57a'),('3609','wikibase-otherprojects','0')
COMMIT

First I thought it would be related to $wgDefaultUserOptions and things missing form it getting deleted, but I don't think that is the case. It looks like something is explicitly setting cx = 0 OR loading a stale value and then calling saveSettings() when accessing Special:Preferences

aaron added a comment.Apr 7 2015, 10:03 PM

...and that would be BetaFeatures, sigh.

aaron added a comment.Apr 7 2015, 10:04 PM

Still trying to figure out why ChronologyProtector doesn't cover this.