I’m looping big ~10k files using go-exiftool. I’m using one instance of the go-exiftool to get info for all required files. This code is called 10k times in the loop, where the file is always different.
fileInfos := et.ExtractMetadata(file)
After the ~7k loops the program hangs. I debugged go-exiftool and found that it hangs in https://github.com/barasher/go-exiftool/blob/master/exiftool.go#L121 on the line: fmt.Fprintln(io.WriteCloser, "-execute")
if i understood correct io.WriteCloser has instance of exec.Command(binary, initArgs...).StdinPipe()
i tried to run the same file in 10k loops. Works fine. It looks like it runs out of memory, can it be? I see no problem in the system memory graph. Or stdin is overflowed. Have no idea how to check that.
another case: if i ignore the last broken file reading, the it stops on the next one.
and more over it works perfekt in debug mode.
so, the questions are:
Does exec.Command has a limit of execution?
If 1) - not, what can be the reason else?
Does it depends on the file sizes? I tried another folder and it worked with 35k files and then hanged. How to check that?
That just writes a filename to the stub of the exiftool, which then opens that file, but it seems to not close it, have you checked lsof output as I suggested?