Page MenuHomePhabricator

Can't merge blocked users: Duplicate entry for key 'ipb_address'
Closed, ResolvedPublic

Description

Author: srainwater

Description:
Versions:
MediaWiki: 1.18.3
PHP: 5.2.17
MySQL: 5.1.39
User Merge and Delete: 1.6.31

When attempting to merge/delete a users who was blocked for spamming, I got the following error:

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

(SQL query hidden)

from within function "DatabaseBase::update". Database returned error "1062: Duplicate entry 'Spammer-2-0-0' for key 'ipb_address' (db.camera-wiki.org)".

Work-around: unblocking the user prior to using merge/delete solves the problem until the bug can be fixed.

Additional info: Our wiki has an account called "Spammer" into which we merge/delete all spammers. This process worked great up until MediaWiki 1.18 at which point we started getting numerous SQL errors during the process. We have already applied the ipb_id to ipb_user change to fix a previous SQL bug.


Version: master
Severity: normal

Details

Reference
bz39470

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 12:57 AM
bzimport set Reference to bz39470.
  • Bug 43114 has been marked as a duplicate of this bug. ***

It seems like ipb_address should be a unique field.

see also https://www.mediawiki.org/w/index.php?title=Extension_talk:UserMerge&dir=prev&offset=20140124142442&limit=20&lqt_mustshow=40885#x.5BWORKAROUND.5D_Duplicate_entry_40885

We are having a pretty big issue as this extension stopped working. We are currently getting an error "1062: Duplicate entry" when trying to merge *anything* (at least that's what it looks like).

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

    UPDATE `ipblocks` SET ipb_user = '43742',ipb_address = 'XXXXXXXXXX' WHERE ipb_user = '43743'

from within function "UserMerge::mergeUser". Database returned error "1062: Duplicate entry 'XXXXXXXXXX-43742-0-0' for key 'ipb_address' (localhost)".

So it's trying to set an ID that's already in-use. Manually inspecting the database shows that indeed both IDs are still in-use. Any clue on why the previous row was not deleted (I am assuming that's what should have been done)? More importantly, why did it not error out when the deletion fail?

Box:

MediaWiki 1.21.3
PHP 5.4.17 (apache2handler)
MySQL 5.5.32
User Merge and Delete 1.8.1 (4fd1c08)

Any suggestions?

Reply
More

CyberXRef☎‎ 01:36, 16 March 2014

  • Bug 65205 has been marked as a duplicate of this bug. ***

Change 160872 had a related patch set uploaded by Legoktm:
Handle merging blocks a bit better

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

cmjohannes wrote:

MediaWiki version: 1.23.3</br>
MySQL version: 5.1.73-log</br>
Operating system: Linux/Apache </br>
UserMerge version with bug version [https://gerrit.wikimedia.org/r/#/c/160872/ 160872] code changes.

I also had previously used the ipbwiki wiki extension. I am having problems merging, then deleting a blocked user. Here are my errors:
<pre>
Database error
A database query error has occurred. This may indicate a bug in the software.
Query:
SELECT Array FROM ipblocks WHERE ((ipb_user = '63598') OR (ipb_user = '66705'))
Function: DatabaseBase::select
Error: 1054 Unknown column 'Array' in 'field list' (localhost)
Backtrace:
#0 /var/www/web3/web.old/includes/db/Database.php(1123): DatabaseBase->reportQueryError('Unknown column ...', 1054, 'SELECT Array ...', 'DatabaseBase::s...', false)
#1 /var/www/web3/web.old/includes/db/Database.php(1590): DatabaseBase->query('SELECT Array ...', 'DatabaseBase::s...')
#2 /var/www/web3/web.old/extensions/UserMerge/MergeUser.php(93): DatabaseBase->select('ipblocks', Array, Array)
#3 /var/www/web3/web.old/extensions/UserMerge/MergeUser.php(165): MergeUser->mergeBlocks(Object(DatabaseMysqli))
#4 /var/www/web3/web.old/extensions/UserMerge/MergeUser.php(31): MergeUser->mergeDatabaseTables()
#5 /var/www/web3/web.old/extensions/UserMerge/SpecialUserMerge.php(126): MergeUser->merge(Object(User))
#6 [internal function]: SpecialUserMerge->onSubmit(Array, Object(HTMLForm))
#7 /var/www/web3/web.old/includes/htmlform/HTMLForm.php(470): call_user_func(Array, Array, Object(HTMLForm))
#8 /var/www/web3/web.old/includes/htmlform/HTMLForm.php(412): HTMLForm->trySubmit()
#9 /var/www/web3/web.old/includes/htmlform/HTMLForm.php(427): HTMLForm->tryAuthorizedSubmit()
#10 /var/www/web3/web.old/includes/specialpage/FormSpecialPage.php(142): HTMLForm->show()
#11 /var/www/web3/web.old/includes/specialpage/SpecialPage.php(379): FormSpecialPage->execute(NULL)
#12 /var/www/web3/web.old/includes/specialpage/SpecialPageFactory.php(503): SpecialPage->run(NULL)
#13 /var/www/web3/web.old/includes/Wiki.php(285): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
#14 /var/www/web3/web.old/includes/Wiki.php(588): MediaWiki->performRequest()
#15 /var/www/web3/web.old/includes/Wiki.php(447): MediaWiki->main()
#16 /var/www/web3/web.old/index.php(46): MediaWiki->run()
#17 {main}
</pre>

cmjohannes wrote:

I am not familiar with how long bugs like this take to get resolved. Is there an ETA or a guess at when this will be resolved? Thanks to all of you who work on stuff like this!

Basically until somebody has reviewed and merged https://gerrit.wikimedia.org/r/#/c/160872/ and there is no review so far... This pretty much depends on individuals and when they find time to do so.

Change 160872 merged by jenkins-bot:
Handle merging blocks a bit better

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