Page MenuHomePhabricator

SSL error (bad write retry) when saving large pages
Open, Needs TriagePublic

Description

I'm running pywikibot with Python 2.7.10, PyOpenSSL 0.15.1 and OpenSSL 1.0.2g and I'm getting an error when trying to save large pages (such as the ro.wp Village Pump, that has ~hundreds of KB:

 ERROR: Traceback (most recent call last):
  File "/work/workspace/pywikibot/pywikibot/data/api.py", line 1953, in submit
    body=body, headers=headers)
  File "/work/workspace/pywikibot/pywikibot/tools/__init__.py", line 1414, in wrapper
    return obj(*__args, **__kw)
  File "/work/workspace/pywikibot/pywikibot/comms/http.py", line 279, in request
    r = fetch(baseuri, method, body, headers, **kwargs)
  File "/work/workspace/pywikibot/pywikibot/comms/http.py", line 434, in fetch
    error_handling_callback(request)
  File "/work/workspace/pywikibot/pywikibot/comms/http.py", line 352, in error_handling_callback
    raise request.data
Error: [('SSL routines', 'ssl3_write_pending', 'bad write retry')]

By reading this discussion, I get the idea that the issue stems from PyOpenSSL, but it seems that it appears only in conjunction with some other bad practice of the http API. Namely, they suggest that the POST data should not contain UTF-8 strings, but rather a byte representation of it. Is it anything that can be done at this level?