Page MenuHomePhabricator

CannotCreateActorException from line 2516 of /../w/includes/user/User.php: Cannot create an actor for a usable name that is not an existing user
Closed, ResolvedPublic

Description

Setup and configuration

  • MediaWiki | 1.33.0-rc.0 (c733c85)19:29, 7. Jun. 2019
  • PHP | 7.2.19-0ubuntu0.18.04.1 (apache2handler)
  • MariaDB | 10.1.40-MariaDB-0ubuntu0.18.04.1
  • Semantic MediaWiki | 3.1.0-alpha (371c70a) 18:09, 6. Jun. 2019

Issue

References SMW issue 4077 / Since the upgrade to MediaWiki 1.33.0-rc.0 the maintenance logging for the maintenance scripts by SMW no longer shown. Moreover it is no longer possible to create new entries using the --with-maintenance-log flag. In the end it issue is that SMW uses users for logging activities that are not registered. Since this worked for quite some time we are looking for advice on how to bring this behaviour back to life.

While this issue appears to be SMW specific there are other extensions around that use specific users for logging and assigning that may not be existing, like DeleteBatch, ReplaceText and probably more.

[1d697fb2d43da21358449d21] [no req]   CannotCreateActorException from line 2516 of /../w/includes/user/User.php: Cannot create an actor for a usable name that is not an existing user

Stacktrace

#0 /../w/includes/ActorMigration.php(220): User->getActorId(Wikimedia\Rdbms\DatabaseMysqli)
#1 /../w/includes/logging/LogEntry.php(718): ActorMigration->getInsertValues(Wikimedia\Rdbms\DatabaseMysqli, string, User)
#2 /../w/extensions/SemanticMediaWiki/src/MediaWiki/ManualEntryLogger.php(73): ManualLogEntry->insert()
#3 /../w/extensions/SemanticMediaWiki/src/Maintenance/MaintenanceLogger.php(69): SMW\MediaWiki\ManualEntryLogger->log(string, User, string, string)
#4 /../w/extensions/SemanticMediaWiki/maintenance/rebuildConceptCache.php(158): SMW\Maintenance\MaintenanceLogger->log(string)
#5 /../w/maintenance/doMaintenance.php(96): SMW\Maintenance\RebuildConceptCache->execute()
#6 /../w/extensions/SemanticMediaWiki/maintenance/rebuildConceptCache.php(188): require_once(string)
#7 {main}

Steps to reproduce

php w/extensions/SemanticMediaWiki/maintenance/rebuildConceptCache.php --create --with-maintenance-log

Produces the following output followed by the stacktrace.

Creating/updating concept caches. Use CTRL-C to abort.

(0) Creating cache for "Concept:Issue/1157/1" ...
(1) Creating cache for "Concept:Issue/1157/2" ...
(2) Creating cache for "Concept:InversePageCreatorLastEditorIs" ...
(3) Creating cache for "Concept:Can be referenced in accordance with" ...
(4) Creating cache for "Concept:Books in German" ...
(5) Creating cache for "Concept:Books in English" ...
(6) Creating cache for "Concept:Books" ...
(7) Creating cache for "Concept:Tracks" ...
(8) Creating cache for "Concept:NFL:Data" ...

Done.

Related Objects

Event Timeline

Kghbln created this task.Jun 8 2019, 5:24 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 8 2019, 5:24 PM
Kghbln added a subscriber: Anomie.Jun 8 2019, 5:25 PM

@Anomie I believe you authored the respective changes for core. Thus pinging you here.

Kghbln updated the task description. (Show Details)Jun 8 2019, 5:31 PM
Paladox added a subscriber: Paladox.Jun 8 2019, 5:49 PM
Anomie closed this task as Resolved.Jun 10 2019, 5:45 PM
Anomie claimed this task.

In the end it issue is that SMW uses users for logging activities that are not registered. Since this worked for quite some time we are looking for advice on how to bring this behaviour back to life.

Yes, that's not supported anymore. You should create the relevant user accounts using User::newSystemUser() from the relevant code, or you could use the 'UserGetReservedNames' hook to render the particular names non-usable. The former would likely be preferable. You can find examples of the use of User::newSystemUser() via https://codesearch.wmflabs.org/search/?q=User%3A%3AnewSystemUser&i=nope&files=&repos=.

I note that it's likely an improvement to not use an unregistered user for these log entries, as it avoids the possibility of confusion if someone were to come along and register that name.

FYI, the restriction being hit here was added in MW 1.31, but only showed up with a non-default value of a configuration setting. That value became the default in 1.33, and the setting will likely be removed entirely (only allowing the new default) in 1.34.

Since SMW bugs are tracked on Github rather than here in Phabricator, and the requested information has been provided, I'm going to close this task as Resolved now. But if you have followup questions, feel free to ask them here.

Thank you for the information that helped resolving the issue. Note that this does not just affect SMW as noted. In the end the change was first noticed there.