Closed SakethValiveti closed 1 year ago
Hi @SakethValiveti, thanks for posting this issue. This issue is currently under extensive investigation. We will get back to you as soon as we will find out the cause. @lukaszsocha2
Hi @SakethValiveti,
I was able to reproduce this error only using Python 3.10.4. With Python 3.9.13 upload works for me without any error. Can you send me your entire python environment details(pip freeze
) to be able to replicate your env on my side. You can try to make an upload after updating all dependencies - you can try with my dependencies:
attrs==22.1.0
boxsdk==3.5.0
certifi==2022.9.24
cffi==1.15.1
charset-normalizer==2.1.1
cryptography==38.0.1
idna==3.4
pycparser==2.21
PyJWT==2.5.0
python-dateutil==2.8.2
requests==2.28.1
requests-toolbelt==0.10.0
six==1.16.0
urllib3==1.26.12
So please let me know what is your current setup and if it helped to upgrade all dependencies. @lukaszsocha2
hi @lukaszsocha2, I'm using docker to run this process. The container has internet access and authenticates using JWT. The JWT points to a service account that is classified as "Co-Owner" to a specific folder to which all files are being uploaded to. It is using Python 3.9.15. OpenSSL version is 1.1.1n. Since you mentioned you had it run successfully through the provided dependency list, I tried using the dependencies you provided. I hit this error after part #172 was uploaded:
| 2022-10-19T11:34:45.320-04:00 | 2022-10-19 15:34:30.989559
| 2022-10-19T11:34:45.320-04:00 | Traceback (most recent call last):
| 2022-10-19T11:34:45.320-04:00 | File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
| 2022-10-19T11:34:45.320-04:00 | httplib_response = self._make_request(
| 2022-10-19T11:34:45.320-04:00 | File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 449, in _make_request
| 2022-10-19T11:34:45.320-04:00 | six.raise_from(e, None)
| 2022-10-19T11:34:45.320-04:00 | File "
Please advise next steps.
@SakethValiveti is it possible to share your Dockerfile so that I could have exactly same environment as you? You can send it to my e-mail: lsocha@box.com. @lukaszsocha2
As a temporary workaround I would recommend to try to authenticate more often by reinitialising you client object, e.g. around each 30 minutes. This should prevent this error from happening until we will identify and solve this error in the correct way.
Hi @lukaszsocha2 I sent the Dockerfile to your email but have a few questions I was hoping you could help me out with.
I thought each authentication count towards to API limits, so I just introduced a time.sleep() of 1 second in between each chunk being uploaded, and this helped with not getting this error.
However, the script ran for over 4 hours for a 20GB file which seems to be way too long even for a 20GB file (I killed the container after the 4 hours, and I'm currently working on getting the logs from there). Could you please help me understand if there's any limits to how fast and how much I can upload to Box.com? Do you have any prior testing statistics you could share with me which would indicate file size vs time-to-upload metric?
Further, I noticed the chunk size is set to 67 MB and that for a 50GB file the SDK splits it into 800 chunks. Can this be modified into say 50 1GB chunks?
Hi @lukaszsocha2 after gathering the logs, it looks like it hit a similar error as initially reported. Please find below the stacktrace.
| 2022-10-20T12:04:34.785-04:00 | 2022-10-20 16:04:34.785076
| 2022-10-20T12:04:48.057-04:00 | [31mRequest "PUT https://upload.box.com/api/2.0/files/upload_sessions/65B5F1B4EC74880EF1CBBE6D2C2798AE" failed with SSLError exception: SSLError(MaxRetryError("HTTPSConnectionPool(host='upload.box.com', port=443): Max retries exceeded with url: /api/2.0/files/upload_sessions/65B5F1B4EC74880EF1CBBE6D2C2798AE (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))"))[0m
| 2022-10-20T12:04:48.057-04:00 | Traceback (most recent call last):
| 2022-10-20T12:04:48.057-04:00 | File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
| 2022-10-20T12:04:48.057-04:00 | httplib_response = self._make_request(
| 2022-10-20T12:04:48.057-04:00 | File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request
| 2022-10-20T12:04:48.057-04:00 | self._validate_conn(conn)
| 2022-10-20T12:04:48.057-04:00 | File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
| 2022-10-20T12:04:48.058-04:00 | conn.connect()
| 2022-10-20T12:04:48.058-04:00 | File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 414, in connect
| 2022-10-20T12:04:48.058-04:00 | self.sock = ssl_wrapsocket(
| 2022-10-20T12:04:48.058-04:00 | File "/usr/local/lib/python3.9/site-packages/urllib3/util/ssl.py", line 449, in ssl_wrap_socket
| 2022-10-20T12:04:48.058-04:00 | ssl_sock = _ssl_wrap_socketimpl(
| 2022-10-20T12:04:48.058-04:00 | File "/usr/local/lib/python3.9/site-packages/urllib3/util/ssl.py", line 493, in _ssl_wrap_socket_impl
| 2022-10-20T12:04:48.058-04:00 | return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
| 2022-10-20T12:04:48.058-04:00 | File "/usr/local/lib/python3.9/ssl.py", line 501, in wrap_socket
| 2022-10-20T12:04:48.059-04:00 | return self.sslsocket_class._create(
| 2022-10-20T12:04:48.059-04:00 | File "/usr/local/lib/python3.9/ssl.py", line 1041, in _create
| 2022-10-20T12:04:48.059-04:00 | self.do_handshake()
| 2022-10-20T12:04:48.059-04:00 | File "/usr/local/lib/python3.9/ssl.py", line 1310, in do_handshake
| 2022-10-20T12:04:48.060-04:00 | self._sslobj.do_handshake()
| 2022-10-20T12:04:48.060-04:00 | ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)
| 2022-10-20T12:04:48.060-04:00 | During handling of the above exception, another exception occurred:
| 2022-10-20T12:04:48.060-04:00 | Traceback (most recent call last):
| 2022-10-20T12:04:48.060-04:00 | File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 489, in send
| 2022-10-20T12:04:48.060-04:00 | resp = conn.urlopen(
| 2022-10-20T12:04:48.060-04:00 | File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
| 2022-10-20T12:04:48.060-04:00 | retries = retries.increment(
| 2022-10-20T12:04:48.060-04:00 | File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
| 2022-10-20T12:04:48.060-04:00 | raise MaxRetryError(_pool, url, error or ResponseError(cause))
| 2022-10-20T12:04:48.060-04:00 | urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='upload.box.com', port=443): Max retries exceeded with url: /api/2.0/files/upload_sessions/65B5F1B4EC74880EF1CBBE6D2C2798AE (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))
| 2022-10-20T12:04:48.060-04:00 | During handling of the above exception, another exception occurred:
| 2022-10-20T12:04:48.060-04:00 | Traceback (most recent call last):
| 2022-10-20T12:04:48.060-04:00 | File "//box-upload-jwt.py", line 187, in
Hi @SakethValiveti, sorry for late response - I was on leave. Box has some rate limiters limiting the volume of requests or actions that can be made against a specific service or feature including upload service. But if this was the case the error returned by API would say this explicitly: "Too many requests" with 429 status code. For me it still looks like more [SSL/requests library/Python language version] issue, cause for me this occurs only when using some Python versions, e.g. when using Python 3.6 it doesn't happen at all. Can you maybe confirm this on your side that Python 3.6 works fine?
It is not possible to set custom size of chunks - they are determined by service when creating upload session see API spec.
Thanks for sending email with DockerFile. I'll try to use it now and see if the same error as yours will occur. Best, @lukaszsocha2
Hi @SakethValiveti,
can you please test if this pr fix your issue - could you checkout branch sdk-2732-fix-connection-reset-error
and use code from this branch to execute the code like before. Then please tell me if the issue still occurs? Please don't change default socket options for this test as you did above.
So I will be very grateful if you could verify if this fix helps. Unfortunately this error is so indeterministic and I wasn't able to reproduce it on my own so I cannot be sure that this error will be gone now. Best, @lukaszsocha2
Description of the Issue
I'm trying to consistently upload large files (10-50GB) using the chunked uploader process. During code execution, the process errors out with following error: [31mRequest "PUT https://upload.box.com/api/2.0/files/upload_sessions/FBCD32A57B4FAE03F7D0611E0FBF2713" failed with SSLError exception: SSLError(MaxRetryError("HTTPSConnectionPool(host='upload.box.com', port=443): Max retries exceeded with url: /api/2.0/files/upload_sessions/FBCD32A57B4FAE03F7D0611E0FBF2713 (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:2396)')))"))[0m
I would like some help in understanding why this error keeps popping up. The upload is being done through a Service Account that has Co-Owner permissions to the folder that the data is being uploaded to.
Steps to Reproduce
Expected Behavior
File upload completes successfully.
Error Message, Including Stack Trace
The following stack trace is when trying to upload a 20GB file. The SDK divided the file into 320 parts. The first two lines are part of my code that print out part#, part size and upload completion time.
Versions Used
Python SDK: boxsdk-3.5.0 Python: Python 3.9.13