Page MenuHomePhabricator

Global block may not be created if expired block has not been pruned
Open, Needs TriagePublic1 Estimated Story PointsBUG REPORT

Description

What is the problem?

When attempting to create a new global block, I got the response:

Via the API:

{
    "error": {
        "globalblock": [
            {
                "code": "globalblocking-block-failure",
                "message": "An error occurred while attempting to globally block ~2024-7017. Please try again."
            }
        ]
    }
}

Via Special:GlobalBlock:

An error occurred while attempting to globally block ~2024-7017. Please try again.

It was against a temp account which had an expired global block. My test environment had a lot of expired global blocks so the prune that was triggered by the block request did not prune their block (the limit is 100). Therefore, I guess the INSERT IGNORE ... query did not insert a new row. It happened regardless of whether I set the modify parameter.

I guess this won't necessarily happen often, but when it does the error message is a bit cryptic and it is unclear how to fix it.

Steps to reproduce problem
  1. $wgUpdateRowsPerQuery = 1;
  2. Create two global blocks with a short expiry date (e.g. 10 seconds)
  3. Wait 10 seconds for the blocks to expire
  4. Create another global block against the last user you blocked in step 2

Expected behaviour: A new global block is created
Observed behaviour: Above error

Environment

Wiki(s): local docker GlobalBlocking – (5808f91) 17:49, 25 October 2024.

Event Timeline

Change #1085587 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/GlobalBlocking@master] Update GlobalBlockingBlockPurger to purge blocks on specific target

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

Change #1085587 merged by jenkins-bot:

[mediawiki/extensions/GlobalBlocking@master] Update GlobalBlockingBlockPurger to purge blocks on specific target

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