Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This is a pickle. I have a job that reads a database full of employee rows and loops that and creates an xml for each employee. There are several phases in the job where the xml file is appended with more and more content. This job has functioned without errors for years.
Now rather unexpectedly in October we started to see this error: tAdvancedFileOutputXML (The process cannot access the file because it is being used by another process). We run this job 3 times a day = 21 times a week and I have begun seeing this error about 3 times a week. It seems random which day and which hour and which tAdvancedFileOutputXML (1, 2 or 3) fails at any given time. There should be no race condition occurring where another process would try to move the file before the write is done.
Should I add tAdvancedFileOutputXML --> tSleep to make it less like likely to conflict? this seem very clumsy.
Should I implement tWaitForFile?
It bugs me that this has suddenly without obvious reasons become a problem since for years it has not caused any issues.
As a workaround, maybe you could store all the employees' info into memory, so you can write it all at once at the end? It would be nice if there were a WaitForFileUnlock component. Maybe you can test the tFileProperties component to see if that mode_string provides you the correct write permission when the file is locked/unlocked - if so, you could use that in combination with a sleep component to sleep until the file is unlocked.