Broken symlink
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 209
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to use s4cmd to backup a very large NFS mounted drive (AWS EFS) to AWS S3, 2.5TB. The server performing the backup has read-only access to this data and is on an isolated server just doing the backup. The NFS data has symlinks that are broken on the backup server, but exist on the production servers. When s4cmd comes across the broken symlink, it can't follow it, and the program dies.
I get this exception:
Exception in thread Thread-2:hread(s)]
Traceback (most recent call last):
File "/usr/local/bin/s4cmd.py", line 520, in run
self.__class__.__dict__[func_name](self, *args, **kargs)
File "/usr/local/bin/s4cmd.py", line 129, in wrapper
ret = func(*args, **kargs)
File "/usr/local/bin/s4cmd.py", line 1317, in upload
fsize = os.path.getsize(source)
File "/usr/lib/python3.6/genericpath.py", line 50, in getsize
return os.stat(filename).st_size
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/efs-prod/REDACTED'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/local/bin/s4cmd.py", line 529, in run
fail('[OSError] %d: %s' % (e.errno, e.strerror))
File "/usr/local/bin/s4cmd.py", line 189, in fail
raise RuntimeError(status)
RuntimeError: 1
The program finishes about another 10 files, and then prints this exception, and then quits:
[Thread Failure] [Errno 2] No such file or directory: '/mnt/efs-prod/REDACTED'
[Runtime Exception] 1
Traceback (most recent call last):
File "/usr/local/bin/s4cmd.py", line 1928, in main
CommandHandler(opt).run(args)
File "/usr/local/bin/s4cmd.py", line 1557, in run
CommandHandler.__dict__[cmd + '_handler'](self, args)
File "/usr/local/bin/s4cmd.py", line 129, in wrapper
ret = func(*args, **kargs)
File "/usr/local/bin/s4cmd.py", line 1690, in dsync_handler
self.s3handler().dsync_files(source, target)
File "/usr/local/bin/s4cmd.py", line 129, in wrapper
ret = func(*args, **kargs)
File "/usr/local/bin/s4cmd.py", line 1004, in dsync_files
pool.join()
File "/usr/local/bin/s4cmd.py", line 594, in join
self.tasks.join()
File "/usr/local/bin/s4cmd.py", line 469, in join
fail('[Thread Failure] ', exc_info=self.exc_info)
File "/usr/local/bin/s4cmd.py", line 189, in fail
raise RuntimeError(status)
RuntimeError: 1
At this point, s4cmd has only processed about half of the tasks it reported in the beginning. I can confirm not all of the data made it to S3.
This is the command I am running:
s4cmd dsync --recursive --force --sync-check --verbose /mnt/efs-prod/REDACTED s3://REDACTED
I am running Ubuntu 18.04 and s4cmd 2.1.0.
To install s4cmd, I ran the following commands:
apt install python3-pip
pip3 install s4cmd
Is there a workaround?
Is there an option to not follow symlinks?
Thanks in advance for your help!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in s4cmd.py at upload around line 1317, where os.path.getsize raises for the broken symlink, then trace how dsync_files at line 1004 propagates the thread failure. Reproduce the reported dsync command with a broken symlink and verify that the resulting behavior is handled without aborting the remaining tasks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100