We have a batch document generation, which generates several word documents based on a template, sets ~20 bookmark texts on each and then converts each of those into a pdf.
This all works when the amount of documents to generate is low, say 1-5. But now the need has risen to support lots more, 40-50 is quite normal. When this batch is run we run into a peculiar, and severe error. Most of the operations succeed correctly, but some of the SaveAs operations seem to create the new pdf file with a wrong name. And what’s most disturbing is that the wrong names are the names of the previous, unaffiliated files, that get overwritten. The actual error then presents itself when the files are downloaded and we get a 404 not found error on the file that gets saved with the wrong name.
As an attachment you find a trace from Fiddler showing the concurrent SaveAs operations, of which two first are correct, but the third returns the wrong filename.
Concurrency issue in your server code, perhaps? Hoping to see a quick solution, as this endangers the content of the documents generated, and may leak wrong information to third parties on top of the actual error situations it generates.
In the log file pay close attention to:
- Request 3 request and response:
- The request specifies that the file should be saved with a filename of "a4dhzda0_2017-03-21T16-30-09.pdf"
- Responses DestDocument.Href = “igwo8p6g_2017-03-21T16-30-08.pdf” instead of the expected “a4dhzda0_2017-03-21T16-30-09.pdf”. The actual response also coincides with that of Request 2 response
- Request 5 response
- The file “a4dhzda0_2017-03-21T16-30-09.pdf” is not found, meaning it actually was written as “igwo8p6g_2017-03-21T16-30-08.pdf” and the original “igwo8p6g_2017-03-21T16-30-08.pdf” replaced
If you need any help from my part, I’m very eager to help out. This needs to be resolved quickly. If you like, I can even do a code review for you, as debugging concurrency issues is quite familiar to me.