Page MenuHomePhabricator

RuntimeError: cannot join current thread after updating to new version/python3
Closed, ResolvedPublic

Description

Pywikibot was downloaded on 20200918 from link at https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation

python version: Python 3.6.9 (default, Jul 17 2020, 12:50:27)
[GCC 8.4.0] on linux

The problem happens with larger wiki-files (upload), which did not cause trouble with earlier version/python2

Error output:

WARNING: Waiting 40.0 seconds before retrying.
Exception in thread Put-Thread:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/mbuch/core_stable/pywikibot/__init__.py", line 1386, in async_manager
    request(*args, **kwargs)
  File "/home/mbuch/core_stable/pywikibot/page/__init__.py", line 99, in handle
    func(self, *args, **kwargs)
  File "/home/mbuch/core_stable/pywikibot/page/__init__.py", line 1315, in _save
    watch=watch, bot=botflag, **kwargs)
  File "/home/mbuch/core_stable/pywikibot/site/_decorators.py", line 94, in callee
    return fn(self, *args, **kwargs)
  File "/home/mbuch/core_stable/pywikibot/site/__init__.py", line 5202, in editpage
    result = req.submit()
  File "/home/mbuch/core_stable/pywikibot/data/api.py", line 1969, in submit
    paramstring)
  File "/home/mbuch/core_stable/pywikibot/data/api.py", line 1729, in _http_request
    self.wait()
  File "/home/mbuch/core_stable/pywikibot/data/api.py", line 2097, in wait
    pywikibot.sleep(delay)
  File "/home/mbuch/core_stable/pywikibot/__init__.py", line 1310, in sleep
    stopme()
  File "/home/mbuch/core_stable/pywikibot/__init__.py", line 1323, in stopme
    _flush(False)
  File "/home/mbuch/core_stable/pywikibot/__init__.py", line 1361, in _flush
    _putthread.join(1)
  File "/usr/lib/python3.6/threading.py", line 1053, in join
    raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread

Event Timeline

It happens when the upload link is too slow and the write operation runs into timeout.

It claims to have terminayes successfully:

1 pages read
1 pages written
0 pages skipped
Execution time: 112 seconds
Read operation time: 8.0 seconds
Write operation time: 112.0 seconds
Script terminated successfully.

But no files have been changed.

The same operation works when done over my phone AP (LTE)

Xqt triaged this task as Medium priority.Sep 20 2020, 10:29 AM
Xqt added subscribers: valhallasw, Xqt.

I guess this is pywikibot stable release.

Change 628580 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Check whether _putthead is not current_thread() to join()

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

Change 628580 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Check whether _putthead is current_thread() to join()

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