vmware / pyvmomi

VMware vSphere API Python Bindings
Apache License 2.0
2.19k stars 766 forks source link

Sporadic trouble uploading large files to VM on ESXi server #1046

Closed mh-ac closed 10 months ago

mh-ac commented 11 months ago

Describe the bug

I am using InitiateFileTransferToGuest and then requests.put to upload a 1.6 GB file to a Linux VM on an ESXi server. This fails sporadically (about in 1-2% of all tries) with the following error:

urllib3.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:2423)

Further details:

Traceback (most recent call last):
  File "C:\Users\mhahn\AppData\Roaming\Python\Python311\site-packages\requests\adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "C:\Users\mhahn\AppData\Roaming\Python\Python311\site-packages\urllib3\connectionpool.py", line 844, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "C:\Users\mhahn\AppData\Roaming\Python\Python311\site-packages\urllib3\util\retry.py", line 515, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='172.20.200.49', port=443): Max retries exceeded with url: /guestFile?id=2019&token=52be17e0-073c-a6a5-b28f-c6e064a411062019 (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2423)')))

Reproduction steps

  1. Start Linux (Ubuntu 20.04) VM on ESXi (8.0.1) server.
  2. Use attached upload_bytes() function
  3. Repeat many times upload_bytes.txt

Expected behavior

upload_bytes should never fail.

Additional context

I am not sure if this is an ESXi, pyVmomi, requests or user code issue. It could also be a timing issue or temporary nonavailability of the target VM.

mh-ac commented 10 months ago

Further testing indicates that it is rather a nonavailability issue rather than a bug.