Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MW1.33+: Maintenance logging no longer works due to missing user #4077

Closed
kghbln opened this issue Jun 8, 2019 · 7 comments · Fixed by #4089
Closed

MW1.33+: Maintenance logging no longer works due to missing user #4077

kghbln opened this issue Jun 8, 2019 · 7 comments · Fixed by #4089
Labels
bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error mediawiki
Milestone

Comments

@kghbln
Copy link
Member

kghbln commented Jun 8, 2019

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

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.

[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.

Notes

When applying the schema changes with update.php the following notes were issued when doing

Beginning migration of logging.log_user and logging.log_user_text to logging.log_actor

..

... log_id=1700
User name "RebuildPropertyStatisticsLogger" is usable, cannot create an anonymous actor for it. Run maintenance/cleanupUsersWithNoId.php to fix this situation.

User name "RebuildConceptCacheLogger" is usable, cannot create an anonymous actor for it. Run maintenance/cleanupUsersWithNoId.php to fix this situation.

User name "RebuildDataLogger" is usable, cannot create an anonymous actor for it. Run maintenance/cleanupUsersWithNoId.php to fix this situation.

... log_id=1800

..

When running maintenance/cleanupUsersWithNoId.php --prefix=sbxsmw as instructed the result was:

Beginning cleanup of logging
... log_timestamp=20160803040402 log_id=2044
... log_timestamp=20160919010104 log_id=2644
... log_timestamp=20161103040402 log_id=3167
... log_timestamp=20161205010105 log_id=3653
... log_timestamp=20170106020205 log_id=4171
... log_timestamp=20170205010104 log_id=4560
... log_timestamp=20170308040402 log_id=4755
... log_timestamp=20170409040402 log_id=5141
... log_timestamp=20170511020205 log_id=5552
... log_timestamp=20170612010104 log_id=5840
... log_timestamp=20170715020206 log_id=6277
... log_timestamp=20170816010106 log_id=6562
... log_timestamp=20170917010110 log_id=6831
... log_timestamp=20171020020206 log_id=7317
... log_timestamp=20171120040402 log_id=7736
... log_timestamp=20171223010108 log_id=8062
... log_timestamp=20180123040402 log_id=8349
... log_timestamp=20180225040402 log_id=8658
... log_timestamp=20180328020205 log_id=8942
... log_timestamp=20180428040403 log_id=9328
... log_timestamp=20180531020211 log_id=9697
... log_timestamp=20180703040406 log_id=9834
... log_timestamp=20180804092147 log_id=10077
... log_timestamp=20180906010104 log_id=10218
... log_timestamp=20181010040405 log_id=10358
... log_timestamp=20181111040407 log_id=10485
... log_timestamp=20181213010111 log_id=10672
... log_timestamp=20190114005109 log_id=10922
... log_timestamp=20190213160732 log_id=11251
... log_timestamp=20190316040403 log_id=11428
... log_timestamp=20190422020401 log_id=11592
... log_timestamp=20190608020402 log_id=21066
Completed cleanup, assigned 0 and prefixed 3195 row(s)
@kghbln kghbln added bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error mediawiki labels Jun 8, 2019
@mwjames
Copy link
Contributor

mwjames commented Jun 8, 2019

[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

Seriously!?!

I'd say that worked before and it should work on 1.33+. I'm not going to invest any time into digging of what has changed, so please contact the responsible WMF developer and ask for support of how to remedy this regression.

@kghbln
Copy link
Member Author

kghbln commented Jun 8, 2019

so please contact the responsible WMF developer and ask for support of how to remedy this regression.

Reported with T225361. I guess in the end we need a sane way of automatically creating the respective users when installing SMW.

@kghbln
Copy link
Member Author

kghbln commented Jun 8, 2019

After manually creating an account called "RebuildConceptCacheLogger" the logging works again. I know that MediaWiki automatically creates new users. Thus it should be possible to do so for Semantic MediaWiki too. Dunno how painful this is though.

@mwjames
Copy link
Contributor

mwjames commented Jun 8, 2019

The following code used to work, raising an exception in MW 1.33+ because of some internal changes is a BC break and should go through a proper deprecation. Furthermore, I expect a migration path so that established functionality can be retained without breaking this in the next release again.

public function log( $type, $performer, $target, $comment ) {
if ( !isset( $this->eventTypes[$type] ) || !$this->eventTypes[$type] ) {
return null;
}
$logEntry = $this->newManualLogEntryForType( $type );
$logEntry->setTarget( Title::newFromText( $target ) );
if ( is_string( $performer) ) {
$performer = User::newFromName( $performer );
}
$logEntry->setPerformer( $performer );
$logEntry->setParameters( [] );
$logEntry->setComment( $comment );
return $logEntry->insert();
}

Thus it should be possible to do so for Semantic MediaWiki too. Dunno how painful this is though.

I don't want to deal with any user/bot/session management as it pulls in MW dependencies and increases the likelihood for a breakage (evidence is this issue itself).

@kghbln
Copy link
Member Author

kghbln commented Jun 10, 2019

The extend of my question on phabricator was not fully understood when it comes to the impact on other extensions but we got an answer.

@mwjames
Copy link
Contributor

mwjames commented Jun 10, 2019 via email

@kghbln
Copy link
Member Author

kghbln commented Jun 12, 2019

If I interpret the answer from the cited phab ticket correctly then the following change should restore known behaviour:

Let's see what happens. I can test with "rebuildFulltextSearchTable.php"

@kghbln kghbln added this to the SMW 3.1.0 milestone Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error mediawiki
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants