Project

General

Profile

Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17)

Added by George Swan about 7 years ago

Hi

I looked through forum notes, and I see that this bug has come up before. Is there now a fix or a workaround for it?

I'm using exiv2 0.24 on Windows 7 professional (64bit)

Works great for small files
But now that I'm tagging 65M tiff files, I'm getting the intermittent failures others have reported with the error message listed in the subject line

Any suggestions? I have 1000's of files to tag!

I call exiv2 via a system call from a perl script. Code fragment is below.

sub tagPhoto{
my ($repeatFlag, $destPhoto, $mapFile, %genAddressLine) = @_;
my $cmd;
my $tag;
my $exiv2Exe = "exiv2.exe";
my $tagKeyword = "Iptc.Application2.Keywords";
my $address;

#construct tag
$tag = sprintf("AAPS-houseNumber:%04d-streetName:%s-sheetNumber:%04d-rollNumber:%02d-dateTaken:%s",
$genAddressLine{"houseNumber"},
$genAddressLine{"streetName"},
$genAddressLine{"sheetNumber"},
$genAddressLine{"negativeNumber"},
$genAddressLine{"dateTaken"} );
if($repeatFlag == 0) {
$cmd = sprintf("-M\"set $tagKeyword $tag\"");
}
else {
$cmd = sprintf("-M\"add $tagKeyword $tag\"");
}
system("$exiv2Exe $cmd \"$destPhoto\"");
}

Replies (16)

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by Robin Mills about 7 years ago

Thomas:
Thanks for mentioning this. I also wondered if r3350 could be the fix for the rename puzzle. The point about the virus checker is interesting. When we open the file, we'll unwittingly trigger a file system change notification which we get the attention of the virus checker. For longer files - 60mb tiffs and video, it seems a good hunch that the virus checker and Exiv2 tussle for ownership of the file.

George:
It would be very helpful for you to run tests with your virus checker on/off. I know it's a bother to backup all your photos for testing purposes - however your contribution would be appreciated. Remember, I have never seen this error - so we really need to get this issue isolated and into a state in which we can reproduce with strong reliability (preferably 100% chance of reproducing it).

Thomas:
Do you have time to revisit issue984.cpp and get it to call execvp while holding a lock?

Good Teamwork here, guys. We'll nail this little guy - he's in our sights.

Robin

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by George Swan about 7 years ago

Ha! I think I got you a good lead on nailing this one

As it happens, I went to my machine to turn of virus checking only to find out that it has been disabled for a few weeks (a different problem for me to address!)

So I started to look for other apps that might have some conflict w/ files

I have dropbox on my machine, and I have an app call hightail (for sending large files to people).

Turn dropbox app off, and exiv2 works just fine on the tifs. Turn dropbox on, and I get errors. Turn dropbox back off and it runs just fine.

I'll try it on a bigger sample (it will take a while) just to test out this idea a little more, but I'd say whatever dropbox is doing to watch files is screwing with exiv2

George

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by George Swan about 7 years ago

My longer test of 100's of tif files worked when dropbox was disabled

I also tried the same test with the hightail file watcher. Same behavior - clashed with exiv2 when active - fine when deactivated

So I think I have a perfectly good workaround for me

Hopefully this helps you guys nail down the problem for real. If there is anything else you want me to try like running a debug version of exiv2, just let me know

Thanks for the help you'all gave me. I'd never have figured this out without the hint about virus checkers

George

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by George Swan about 7 years ago

Another test case

My source tif files are in a folder called 'tif', and I write the tagged tif files into a subfolder called 'tagged'. If I leave the windows explorer looking at the tif folder (not even the tagged folder) then I get errors. If I move up to the parent directory of tif and view that in windows explorer, I don't get errors. Also a file watching issue?

George

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by Robin Mills about 7 years ago

Thanks, George.

This teamwork stuff really works. It's Thomas who thought of the virus checker and provided a patch for it. That patch has been submitted, however the trunk is currently broken on MSVC builds. We're working to fix the build of course.

I suspect Thomas' fix for this will also solve your interesting find about the Explorer.

May I ask you to sync/build r3354 and test with that. I know that build is OK (passes our test harness on all platforms). It contains Thomas' fix for the rename issue.

Robin

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by George Swan about 7 years ago

unfortunately, I don't have the ability to build s/w on windows. I don't believe I have access to MSVC. Is there an ftp site or some other way I could download the exe once your build problems are resolved?

george

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by Robin Mills about 7 years ago

George

Yes. http://clanmills.com/files/Exiv2-Win32-ReleaseDLL-r3359.zip Copy exiv2.exe and the 3'dlls (exiv2, libexpat and zlib1) to any directory and you should be able to execute exiv2.exe

One of the projects in progress for Exiv2 v0.25 is a Build Server created using Jenkins. http://exiv2.dyndns.org:8080

I'll check the box for "Keep build artifacts" and see what happens and update this thread. Going forward, the server will retain "old" builds. The Jenkins work is in development and I haven't bothered to try this option yet. However your request is a good reason to start using this.

Robin

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by George Swan about 7 years ago

Unfortunately, that version of exiv2 didn't solve it for me

I downloaded the zip file and put the various exes and dll into the right place (I'm pretty sure I did it right)
When I 'watched' the tif folder while running my script, I got the same spurious errors. When I moved up to the parent folder, I did not

However, I did look at the version # for the exiv2 I was using, and the one you suggested I download. They both had version 0.24 (001800) (32-bit) when I ran 'exiv2 -V'. I would have expected 0.25 dev or something like that for the newest download. Did I do something wrong?

I'm going to be largely out of pocket until Fri pm. I'll try and respond to emails, but it might be difficult. I have a workaround so I'm not under time pressure, but if I can help you solve your issue while it's top of mind, I'd like to

George

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by Thomas Beutlich about 7 years ago

Bad news that r3350 did not work here. :-(

George Swan wrote:

Another test case

My source tif files are in a folder called 'tif', and I write the tagged tif files into a subfolder called 'tagged'. If I leave the windows explorer looking at the tif folder (not even the tagged folder) then I get errors. If I move up to the parent directory of tif and view that in windows explorer, I don't get errors. Also a file watching issue?

George, does this happen with virus checker, hightail and dropbox watchers turned off?

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by George Swan about 7 years ago

The new exe works if I do not have window explorer watching the tif folder and Dropbox and hightail are activated. That's great progress!!

However if I deactivate Dropbox/hightail but still watch the tif folder, I do still get errors

George

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by Robin Mills about 7 years ago

Thanks for the update, George. That's very interesting about Explorer. I've found ProcExp (from sysinternals.com) is very useful for debugging stuff like this. If you know which file is involved, you can get ProcExp to watch him. There are many other great utilities sysinternals.com for monitoring the filesystem, sockets, registry and all manner of "under the hood" stuff.

I'm very pleased that r3359.zip is working for you. I'm off the hook for the moment in getting you another build! The build server said "don't know what artefacts to archive" or something equally hopeless. I'll have to work on this. Sadly I murdered the Build Server's Windows Build VM by mistake. I'll get a new VM running and debug the artefacts publishing at the weekend.

Thanks for persevering with this, George. The toughest part of many bugs is correctly identifying the issue and having a solid way to reproduce it. Your efforts are very helpful. Thank You.

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by George Swan about 7 years ago

Hi robin

My s/w days are well over, but I'll experiment with procexp
The problem is that out of a test case of even only 20 files, it's completely unpredictable as to which file will get the errno=17 message

I'm out of town till fri, and will have some time to experiment over the weekend

Any thing in particular you'd want me to monitor/ capture while running procexp?

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by Robin Mills about 7 years ago

Gosh, I can't really say exactly what to monitor. If you find a collection of 20 files that "bomb" the code, that's wonderful. You can push them on a server somewhere (Google Docs?), or send me a DVD. If I can reproduce this, that's a huge step in the right direction.

We can talk 1-to-1 at the weekend on Skype if you wish. In which time-zone are you? I'm in England.

Robin

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by George Swan about 7 years ago

Hi robin

I could totally zip up the files and my perl script for you this weekend.

Please email me your address at and I'll send it

I live in california so there will be 8 hours of time difference. We can chat/ Skype

I'll try running my script on a different PC to see if I can reproduce there also. The PC I currently use is pretty high end and I wonder if the conflict is timing dependent

My experience with running my script is that if I am going to see the conflict, I'm going to see it happen within the first ~10-20 files

RE: Still getting the "exception in modify action... failed to rename file to <file><id>: file exists (errno = 17) - Added by Robin Mills about 7 years ago

George

Thank you for your private emails about this matter. Regrettably, we haven't isolated this issue. It's either been fixed (by Thomas Fix in http://dev.exiv2.org/issues/984), or it will resurface and we'll capture him at that time.

I appreciate the effort you have put into this and look forward to having lunch with you when I'm California later in October.

Robin

    (1-16/16)