Page MenuHomePhabricator

Campaign creation does not work any more
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • I tried to create a campaign

What happens?:

  • I get a message telling me "Sorry test Creation Campaign Could not be created"
  • The campaign actually appears in the dashboard, but it is empty

See here : https://isa.toolforge.org/campaigns

What should have happened instead?:

  • It should have been created

Generally speaking, since early June, all campaigns that were actually created, are empty.

Event Timeline

Change 936033 had a related patch set uploaded (by Sebastian Berlin (WMSE); author: Sebastian Berlin (WMSE)):

[labs/tools/Isa@master] Update usage of isa.main.utils.commit_changes_to_db()

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

It looks like this was caused by fcbd3fc, which changed how commit_changes_to_db() works. Specifically the function's return value was changed from True when there was an error committing to the database to True when a commit was successful. The change in itself makes sense, but most of the place where the function was called weren't updated.

What happened when creating campaigns was that the campaign was added to the database with all the correct values, but triggered the error message. It also didn't try to update, since it thought it didn't add it to the database, which meant no images were added.

This likely caused other problems too, like if someone tried to log in with the tool for the first time they probably would've an error message, even if the account was added successfully.

I tried to update the previously failed campaign. I got again an error message and there is still no content associated to that old campaign. https://isa.toolforge.org/campaigns/276

Campaign II.png (1×2 px, 851 KB)

Campaign I.png (1×2 px, 728 KB)

I thought maybe the fact it was a campaign created when the system was not working was the issue. So I created a new campaign. Again an error message when I saved. And there is no content in the campaign
https://isa.toolforge.org/campaigns/279

There is no fix deployed on https://isa.toolforge.org yet. I'll update here when there is.

Change 937895 had a related patch set uploaded (by Sebastian Berlin (WMSE); author: Sebastian Berlin (WMSE)):

[labs/tools/Isa@m2c-rollback] Update usage of isa.main.utils.commit_changes_to_db()

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

Change 936033 abandoned by Sebastian Berlin (WMSE):

[labs/tools/Isa@master] Update usage of isa.main.utils.commit_changes_to_db()

Reason:

Moved to branch m2c-rollback

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

Change 937895 merged by jenkins-bot:

[labs/tools/Isa@m2c-rollback] Update usage of isa.main.utils.commit_changes_to_db()

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

Something is up with sending requests to the Commons API from Toolforge. When I ran it there I eventually got the error below. When I ran it locally it worked just fine.

Traceback (most recent call last):
  File "/data/project/isa-dev/www/python/src/isa/campaigns/image_updater.py", line 58, in update
    updater.update_images()
  File "/data/project/isa-dev/www/python/src/isa/campaigns/image_updater.py", line 107, in update_images
    self._fetch_images(category["name"], depth)
  File "/data/project/isa-dev/www/python/src/isa/campaigns/image_updater.py", line 160, in _fetch_images
    response = self._api_get(parameters)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa-dev/www/python/src/isa/campaigns/image_updater.py", line 252, in _api_get
    response = requests.get(
               ^^^^^^^^^^^^^
  File "/data/project/isa-dev/www/python/venv/lib/python3.11/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa-dev/www/python/venv/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa-dev/www/python/venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa-dev/www/python/venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/project/isa-dev/www/python/venv/lib/python3.11/site-packages/requests/adapters.py", line 517, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='commons.wikimedia.org', port=443): Max retries exceeded with url: /w/api.php?action=query&list=categorymembers&cmtitle=Category%3AMonkeys&cmlimit=max&cmprop=title%7Ctype%7Cids&cmtype=subcat%7Cfile&format=json&formatversion=2&origin=%2A (Caused by SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:992)')))

The maintenance script that updates run fine on Toolforge. It runs the same function as when images are updated via the web UI, so it looks like how it's run is the issue. Maybe the thread solution isn't holding up, though I'm not sure why it's failing now.

I tried replacing the threaded function call with non-threaded call to the same update function and it worked fine. I'll look into Flask's recommended way of running background jobs.

Change 938845 had a related patch set uploaded (by Sebastian Berlin (WMSE); author: Sebastian Berlin (WMSE)):

[labs/tools/Isa@m2c-rollback] Use Celery for background jobs

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

Change 938845 merged by jenkins-bot:

[labs/tools/Isa@m2c-rollback] Use Celery for background jobs

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

Mentioned in SAL (#wikimedia-cloud) [2023-07-25T07:40:46Z] <wm-bot> <sebastian-berlin-wmse> Deployed from scratch. Changes from previously deployed version: bdf632a Pin required package versions; 471967f Update usage of isa.main.utils.commit_changes_to_db() (T340485, T338624); cf008eb Add semi automatic script for deploying on Toolforge; 0b135aa Use Celery for background jobs (T340485).