File Exists errors #1

Open
farviewsoft opened this Issue Feb 3, 2012 · 2 comments

Comments

Projects
None yet
1 participant
@ghost

ghost commented Feb 3, 2012

I'm intermittently getting a 'File Exists' error in my logs for code that uses the 'put_dir' method:

550 /VOLUME1/WWW/[path to directory]: File exists
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/ftp.rb:243:in `getresp'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/ftp.rb:264:in `sendcmd'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/ftp.rb:262:in `sendcmd'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/ftp.rb:711:in `mkdir'
/Library/Ruby/Gems/1.8/gems/ftp-ext-0.1.4/lib/ftp-ext.rb:34:in `put_dir'
/Library/Ruby/Gems/1.8/gems/ftp-ext-0.1.4/lib/ftp-ext.rb:30:in `times'
/Library/Ruby/Gems/1.8/gems/ftp-ext-0.1.4/lib/ftp-ext.rb:30:in `put_dir'
...
[The rest of the stack trace goes back to the method that called 'put_dir']

When I go to check on the file that was uploaded as part of this error message, the file is present. Which would say to me that there's an error trap on the directory creation code missing. I briefly looked at the gem code and couldn't work out what what going on because it doesn't happen consistently.

@ghost

ghost commented Feb 4, 2012

Actually, I think I know what's going on here... I have two workers who potentially connect to the ftp server at the same time uploading different images to the same directory which may or may not exist.

My current theory is that they both detect no directory and one of them gets there first and the other worker throws an exception. Still looking into this.

@ghost

ghost commented Feb 7, 2012

The line in my code that's throwing this exception.

ftp.put_dir(:local => dir_path, :remote => remote_dir, :erase => erase)

I have confirmed that both directories are present at the time of the exception. Perhaps the erase argument is really what's causing problems here.

farviewsoft closed this Feb 7, 2012

farviewsoft reopened this Feb 7, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment