Page MenuHomePhabricator

"cannot join current thread" during network problem
Open, Needs TriagePublic

Description

This often occurs if I'm using an unreliable internet access (e.g. WiFi). However I can not reproduce it directly. Debug message (using newitem.py):

WARNING: Waiting 40 seconds before retrying.
Waiting for 64 pages to be put. Estimated time remaining: 0:01:04
Exception in thread Put-Thread:
Traceback (most recent call last):
  File "D:\Dev\Python36\lib\site-packages\urllib3\connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "D:\Dev\Python36\lib\site-packages\urllib3\connectionpool.py", line 850, in _validate_conn
    conn.connect()
  File "D:\Dev\Python36\lib\site-packages\urllib3\connection.py", line 326, in connect
    ssl_context=context)
  File "D:\Dev\Python36\lib\site-packages\urllib3\util\ssl_.py", line 329, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "D:\Dev\Python36\lib\ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "D:\Dev\Python36\lib\ssl.py", line 814, in __init__
    self.do_handshake()
  File "D:\Dev\Python36\lib\ssl.py", line 1068, in do_handshake
    self._sslobj.do_handshake()
  File "D:\Dev\Python36\lib\ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
socket.timeout: _ssl.c:761: The handshake operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Dev\Python36\lib\site-packages\requests\adapters.py", line 440, in send
    timeout=timeout
  File "D:\Dev\Python36\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "D:\Dev\Python36\lib\site-packages\urllib3\util\retry.py", line 357, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "D:\Dev\Python36\lib\site-packages\urllib3\packages\six.py", line 686, in reraise
    raise value
  File "D:\Dev\Python36\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "D:\Dev\Python36\lib\site-packages\urllib3\connectionpool.py", line 349, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
  File "D:\Dev\Python36\lib\site-packages\urllib3\connectionpool.py", line 309, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='en.wikipedia.org', port=443): Read timed out. (read timeout=6.05)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\db\core\pywikibot\data\api.py", line 1969, in submit
    body=body, headers=headers)
  File "D:\db\core\pywikibot\tools\__init__.py", line 1450, in wrapper
    return obj(*__args, **__kw)
  File "D:\db\core\pywikibot\comms\http.py", line 316, in request
    r = fetch(baseuri, method, params, body, headers, **kwargs)
  File "D:\db\core\pywikibot\comms\http.py", line 518, in fetch
    error_handling_callback(request)
  File "D:\db\core\pywikibot\comms\http.py", line 404, in error_handling_callback
    raise request.data
  File "D:\db\core\pywikibot\comms\http.py", line 383, in _http_process
    **http_request.kwargs)
  File "D:\Dev\Python36\lib\site-packages\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\Dev\Python36\lib\site-packages\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "D:\Dev\Python36\lib\site-packages\requests\adapters.py", line 521, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='en.wikipedia.org', port=443): Read timed out. (read timeout=6.05)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Dev\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "D:\Dev\Python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "D:\db\core\pywikibot\__init__.py", line 1409, in async_manager
    request(*args, **kwargs)
  File "D:\db\core\pywikibot\page.py", line 121, in handle
    callback(self, err)
  File "scripts\newitem.py", line 120, in <lambda>
    page, callback=lambda _, exc: self._callback(page, exc))
  File "scripts\newitem.py", line 83, in _callback
    self._touch_page(page)
  File "scripts\newitem.py", line 70, in _touch_page
    page.touch()
  File "D:\db\core\pywikibot\page.py", line 1420, in touch
    apply_cosmetic_changes=False, **kwargs)
  File "D:\db\core\pywikibot\tools\__init__.py", line 1450, in wrapper
    return obj(*__args, **__kw)
  File "D:\db\core\pywikibot\tools\__init__.py", line 1450, in wrapper
    return obj(*__args, **__kw)
  File "D:\db\core\pywikibot\page.py", line 1273, in save
    cc=apply_cosmetic_changes, quiet=quiet, **kwargs)
  File "D:\db\core\pywikibot\page.py", line 127, in wrapper
    handle(func, self, *args, **kwargs)
  File "D:\db\core\pywikibot\page.py", line 109, in handle
    func(self, *args, **kwargs)
  File "D:\db\core\pywikibot\page.py", line 1284, in _save
    watch=watch, bot=botflag, **kwargs)
  File "D:\db\core\pywikibot\site.py", line 1317, in callee
    return fn(self, *args, **kwargs)
  File "D:\db\core\pywikibot\site.py", line 5193, in editpage
    result = req.submit()
  File "D:\db\core\pywikibot\data\api.py", line 1993, in submit
    self.wait()
  File "D:\db\core\pywikibot\data\api.py", line 2228, in wait
    pywikibot.sleep(self.retry_wait)
  File "D:\db\core\pywikibot\__init__.py", line 1334, in sleep
    stopme()
  File "D:\db\core\pywikibot\__init__.py", line 1347, in stopme
    _flush(False)
  File "D:\db\core\pywikibot\__init__.py", line 1383, in _flush
    _putthread.join(1)
  File "D:\Dev\Python36\lib\threading.py", line 1053, in join
    raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread

Ctrl+C can not exit the process.