I keep seeing the following error when using gsutil
ResumableUploadAbortException: Upload complete with 6275 additional bytes left in stream
The command is very simple, something like
gsutil cp -r <source_path> gs://<target-bucket>/<target_path>
with about 80 files inside <source_path>
. There are nested folders inside <source_path>
, as well. Changing gsutil cp
to gsutil -m cp
doesn't make a difference. And this error is reproducible when I run it inside a python script together with lots of a other code. However, when I run the command separately in bash, it doesn't seem to have any problem. So I wonder what could possibly be the reason to ResumableUploadAbortException, please?
Tail of debug output with gsutil -D -m cp
total_bytes_transferred: 794750002
Total bytes copied=794750002, total elapsed time=7.932 secs (95.55 MiBps)
DEBUG: Exception stack trace:
Traceback (most recent call last):
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/__main__.py", line 565, in _RunNamedCommandAndHandleExceptions
parallel_operations, perf_trace_token=perf_trace_token)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/command_runner.py", line 280, in RunNamedCommand
return_code = command_inst.RunCommand()
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/commands/cp.py", line 998, in RunCommand
self.op_failure_count, plural_str, plural_str))
CommandException: CommandException: 1 file/object could not be transferred.
gsutil version: 4.19
– Woodwaxengsutil
. How are you calling gsutil from Python? You can collect agsutil -D cp
log to see if the byte ranges that gsutil is attempting to send initially match your expected file size(s). – Wappesgsutil
and the problem is still reproducible. Though I think it unlikely, if it's a flushing problem, does it mean I need to use something likesys.stdout.flush
? – Woodwaxengsutil
or any other utility can safely copy them. As for the debug log, generally what you're looking for is the HTTP header likecontent-range: bytes 0-999/1000
after a PUT /resumable/upload/storage request. The size in that header should match your expected size in the source file. – Wappes