Page MenuHomePhabricator

CI tests fails with TimeoutError in _json_loads when userinfo is retrieved
Closed, ResolvedPublicBUG REPORT

Description

Since yesterday CI tests fails when userinfo is retrieved during cookie login, see traceback below

18:35:36 ======================================================================
18:35:36 ERROR: setUpClass (tests.site_tests.TestProductionAndTestSite)
18:35:36 ----------------------------------------------------------------------
18:35:36 Traceback (most recent call last):
18:35:36   File "/src/tests/aspects.py", line 464, in setUpClass
18:35:36     super().setUpClass()
18:35:36   File "/src/tests/aspects.py", line 936, in setUpClass
18:35:36     data['site'] = Site(data['code'], data['family'],
18:35:36   File "/src/pywikibot/__init__.py", line 254, in Site
18:35:36     _sites[key] = interface(code=code, fam=fam, user=user)
18:35:36   File "/src/pywikibot/site/_datasite.py", line 40, in __init__
18:35:36     super().__init__(*args, **kwargs)
18:35:36   File "/src/pywikibot/site/_apisite.py", line 138, in __init__
18:35:36     self.login(cookie_only=True)
18:35:36   File "/src/pywikibot/site/_apisite.py", line 394, in login
18:35:36     if self.userinfo['name'] == self.user():
18:35:36   File "/src/pywikibot/site/_apisite.py", line 672, in userinfo
18:35:36     uidata = uirequest.submit()
18:35:36   File "/src/pywikibot/data/api/_requests.py", line 1022, in submit
18:35:36     result = self._json_loads(response)
18:35:36   File "/src/pywikibot/data/api/_requests.py", line 789, in _json_loads
18:35:36     self.wait()
18:35:36   File "/src/pywikibot/data/api/_requests.py", line 982, in wait
18:35:36     super().wait(delay)
18:35:36   File "/src/pywikibot/data/__init__.py", line 47, in wait
18:35:36     raise pywikibot.exceptions.TimeoutError(
18:35:36 pywikibot.exceptions.TimeoutError: Maximum retries attempted without success.
18:35:36 
18:35:36 ======================================================================
18:35:36 ERROR: setUpClass (tests.file_tests.TestMediaInfoEditing)
18:35:36 ----------------------------------------------------------------------
18:35:36 Traceback (most recent call last):
18:35:36   File "/src/tests/aspects.py", line 575, in setUpClass
18:35:36     super().setUpClass()
18:35:36   File "/src/tests/aspects.py", line 541, in setUpClass
18:35:36     super().setUpClass()
18:35:36   File "/src/tests/aspects.py", line 464, in setUpClass
18:35:36     super().setUpClass()
18:35:36   File "/src/tests/aspects.py", line 936, in setUpClass
18:35:36     data['site'] = Site(data['code'], data['family'],
18:35:36   File "/src/pywikibot/__init__.py", line 254, in Site
18:35:36     _sites[key] = interface(code=code, fam=fam, user=user)
18:35:36   File "/src/pywikibot/site/_datasite.py", line 40, in __init__
18:35:36     super().__init__(*args, **kwargs)
18:35:36   File "/src/pywikibot/site/_apisite.py", line 138, in __init__
18:35:36     self.login(cookie_only=True)
18:35:36   File "/src/pywikibot/site/_apisite.py", line 394, in login
18:35:36     if self.userinfo['name'] == self.user():
18:35:36   File "/src/pywikibot/site/_apisite.py", line 672, in userinfo
18:35:36     uidata = uirequest.submit()
18:35:36   File "/src/pywikibot/data/api/_requests.py", line 1022, in submit
18:35:36     result = self._json_loads(response)
18:35:36   File "/src/pywikibot/data/api/_requests.py", line 789, in _json_loads
18:35:36     self.wait()
18:35:36   File "/src/pywikibot/data/api/_requests.py", line 982, in wait
18:35:36     super().wait(delay)
18:35:36   File "/src/pywikibot/data/__init__.py", line 47, in wait
18:35:36     raise pywikibot.exceptions.TimeoutError(
18:35:36 pywikibot.exceptions.TimeoutError: Maximum retries attempted without success.

Tests works locally.
With tests using Python 3.12 the problem can be indentified a bit more: Its commons:beta which gives the problem: https://integration.wikimedia.org/ci/job/pywikibot-core-tox-deeptest-py312/610/console

See also T399157

Event Timeline

Xqt triaged this task as High priority.Jul 12 2025, 4:45 PM
Xqt changed the subtype of this task from "Task" to "Bug Report".
Xqt updated the task description. (Show Details)

Change #1168490 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [WIP] Inspect T399367 failures

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

Analysing the content gives: Error: 403, Requests from your IP have been blocked, please see https://wikitech.wikimedia.org/wiki/Beta/Blocked for more information. at Sun, 13 Jul 2025 08:28:57 GMT

CI IP is blocked upstream for CI tests?

Xqt added a subtask: Restricted Task.Jul 13 2025, 8:58 AM
Xqt moved this task from To upstream/missing upstream link to Reported Upstream on the Upstream board.
hashar closed subtask Restricted Task as Resolved.Jul 13 2025, 9:22 AM

Change #1168490 abandoned by Xqt:

[pywikibot/core@master] [WIP] Inspect T399367 failures

Reason:

solved

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

Xqt claimed this task.
Xqt added a subscriber: hashar.

Thank you @hashar!

Xqt removed Xqt as the assignee of this task.Jul 13 2025, 7:35 PM

That is slightly different though, this time it is GitHub IP range that got blocked. We'd need to know their range of IPs?

Edit: https://api.github.com/meta

GitHub Actions are going to be using the same IP blocks as Microsoft Azure. As long as we are blocking in Beta Cluster based solely on IPv4 address I'm not sure that there is a good way to allow list tests from projects we are friendly with while keeping out misbehaving bots.

Change #1175214 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] Tests: skip test if IP is blocked

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

Change #1175214 merged by jenkins-bot:

[pywikibot/core@master] Tests: skip test if IP is blocked

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

Change #1175215 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] Tests: skip test if IP is blocked

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

Change #1175215 merged by Xqt:

[pywikibot/core@master] Tests: skip test if IP is blocked

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

Xqt renamed this task from CI tests fails with TimeoutError when userinfo is retrieved to CI tests fails with TimeoutError in _json_loads when userinfo is retrieved.Aug 29 2025, 5:39 PM
Xqt claimed this task.