Page MenuHomePhabricator

Wikitech error when adding users to projects
Closed, ResolvedPublic

Description

When I add a new member to a project, wikitech grinds forever and then comes up with

[d255656a1d02d26f7e9aca32] 2017-02-25 00:55:12: Fatal exception of type "UnexpectedValueException"

The user addition seems to work just fine, but this is still pretty ugly.

This is maybe the result of the change in a keystone hook, but I haven't properly backed up to check yet.

Event Timeline

Andrew created this task.Feb 25 2017, 12:56 AM
Restricted Application removed a project: Patch-For-Review. · View Herald TranscriptFeb 25 2017, 12:56 AM
bd808 added a subscriber: bd808.Mar 26 2017, 10:59 PM

The logged exception was:

UnexpectedValueException from line 196 of /srv/mediawiki/php-1.29.0-wmf.13/includes/user/UserGroupMembership.php: UserGroupMembership::insert() needs a positive user ID. Did you forget to add your User object to the database before calling addGroup()?
bd808 moved this task from Triage to Backlog on the Cloud-Services board.Mar 26 2017, 10:59 PM
Andrew removed Andrew as the assignee of this task.Apr 12 2017, 5:46 PM

I haven't tracked down the relationship, but I suspect this issue is a symptom of token overload, addressed in T163259. That bug should be fixed (albeit poorly) -- does this one look better to you as well?

The logged exception was:

UnexpectedValueException from line 196 of /srv/mediawiki/php-1.29.0-wmf.13/includes/user/UserGroupMembership.php: UserGroupMembership::insert() needs a positive user ID. Did you forget to add your User object to the database before calling addGroup()?

That's the same exception message in T163032: UserGroupMembership::insert() needs a positive user ID exception breaking AbuseFilter block function...

TTO added a subscriber: TTO.Apr 19 2017, 6:29 AM

Do we have a stack trace for this? The only possibly relevant call to User::addGroup() I could find is https://phabricator.wikimedia.org/diffusion/EOST/browse/master/special/SpecialNovaProject.php$472.

2017-02-25 00:50:02 [63aa22b668ebe4dde03fc343] silver labswiki 1.29.0-wmf.13 exception ERROR: [63aa22b668ebe4dde03fc343] /wiki/Special:NovaProject   UnexpectedValueExceptio
n from line 196 of /srv/mediawiki/php-1.29.0-wmf.13/includes/user/UserGroupMembership.php: UserGroupMembership::insert() needs a positive user ID. Did you forget to add you
r User object to the database before calling addGroup()? {"exception_id":"63aa22b668ebe4dde03fc343","caught_by":"mwe_handler"} 
[Exception UnexpectedValueException] (/srv/mediawiki/php-1.29.0-wmf.13/includes/user/UserGroupMembership.php:196) UserGroupMembership::insert() needs a positive user ID. Di
d you forget to add your User object to the database before calling addGroup()?
  #0 /srv/mediawiki/php-1.29.0-wmf.13/includes/user/User.php(3412): UserGroupMembership->insert(boolean)
  #1 /srv/mediawiki/php-1.29.0-wmf.13/extensions/OpenStackManager/special/SpecialNovaProject.php(472): User->addGroup(string)
  #2 [internal function]: SpecialNovaProject->tryAddMemberSubmit(array, HTMLForm)
  #3 /srv/mediawiki/php-1.29.0-wmf.13/includes/htmlform/HTMLForm.php(663): call_user_func(array, array, HTMLForm)
  #4 /srv/mediawiki/php-1.29.0-wmf.13/includes/htmlform/HTMLForm.php(555): HTMLForm->trySubmit()
  #5 /srv/mediawiki/php-1.29.0-wmf.13/includes/htmlform/HTMLForm.php(570): HTMLForm->tryAuthorizedSubmit()
  #6 /srv/mediawiki/php-1.29.0-wmf.13/extensions/OpenStackManager/special/SpecialNovaProject.php(90): HTMLForm->show()
  #7 /srv/mediawiki/php-1.29.0-wmf.13/extensions/OpenStackManager/special/SpecialNovaProject.php(41): SpecialNovaProject->addMember()
  #8 /srv/mediawiki/php-1.29.0-wmf.13/includes/specialpage/SpecialPage.php(522): SpecialNovaProject->execute(NULL)
  #9 /srv/mediawiki/php-1.29.0-wmf.13/includes/specialpage/SpecialPageFactory.php(577): SpecialPage->run(NULL)
  #10 /srv/mediawiki/php-1.29.0-wmf.13/includes/MediaWiki.php(285): SpecialPageFactory::executePath(Title, RequestContext)
  #11 /srv/mediawiki/php-1.29.0-wmf.13/includes/MediaWiki.php(860): MediaWiki->performRequest()
  #12 /srv/mediawiki/php-1.29.0-wmf.13/includes/MediaWiki.php(521): MediaWiki->main()
  #13 /srv/mediawiki/php-1.29.0-wmf.13/index.php(43): MediaWiki->run()
  #14 /srv/mediawiki/w/index.php(3): require(string)
  #15 {main}
TTO added a comment.Apr 19 2017, 8:59 AM

Is it possible that for some reason, the user to which OpenStackManager is trying to add the group doesn't actually exist? Although User::addGroup could do a better job of handling this error more gracefully, I wonder if this is actually exposing a bug in OSM.

If anything it's most likely that OSM is adding a user to a group when the user is already in the group -- much of T150091 involved duplicating OSM behavior in a keystone callback. That said, in my tests it handled the duplication of effort without complaint.

@Legoktm are you able to actually produce this issue, or are you still digging back into that previous occurrence?

Andrew closed this task as Resolved.Apr 27 2017, 1:59 PM
Andrew claimed this task.