-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dotnet test: warning: Overwriting results file: duplicate trx file #2489
Comments
@kanchm Would it be okay for you if the content of file will be appended instead of overwriting it? |
@Sanan07 gave this to Medeni a bit ago, but forgot to assign it please sync. |
Would appending mean merge the two XML files? File level append is not an option. Also this would be unsafe. The two independent appends would still step on each other. An approach is to use Path.GetTempFileName which would reserve the name by creating the file and letting the trx writer overwrite it. You would not warn on the overwrite in this scenario. Also, related to this is LogFilePrefix which could be improved by adding milliseconds "ffff" as I hit collisions at a second granularity when I tried it. |
Actually I am thinking to append a number to end of it, if there is a collusion. In this case it could be |
In this case you should take care of several possibilities of the same file collision, so you should store mapping for each file name. |
I am not sure if we rely on the naming somewhere. If we do, I would consider checking if the name already exists, and adding 1s to the name, until we find a non-conflicting name: e.g 04231817_2020-07-17_17_41_25.trx -> 04231817_2020-07-17_17_41_26.trx if we don't, then adding the milliseconds as suggested above. if we are changing how the file is named, adding the ms is probably better than adding a suffix. |
@Sanan07 of course I'll be checking for the first available number and not just append @nohwnd as far as I see we don't. I am checking though. I don't like the idea of adding a second (because it will be misleading of actual log start time) or moving to millisecond granularity mainly because it would not fix the problem, just make it harder to occur. |
@ShreyasRmsft do you depend on the trx name in azdo? Or do you think we are free to change the format? I would guess some users are depending on it in their own pipelines, what do you think?
I don't think I would ever notice unless this occurs a lot of times in the row an pushes my timestamp by a full minute.
You can "wait" 1 ms and try checking the filename again, then it won't happen ever, unless there is result file written every ms, which is veeery unlikely. |
@nohwnd there are tasks that depend on trx naming conventions when uploading results, my suggestion is to not make any changes to the defaults but use cmdline paramters to modify the naming conventions if needed. |
@ShreyasRmsft thank you for the warning. In that case we might go with @nohwnd's suggestion IMO. |
Description
When we start up tests from a solution file using
dotnet test -l trx
, we encounter this warning occasionally:EXEC : warning : Overwriting results file: D:\...\TestResults\2020.07.17-17.41.02\...04231817_2020-07-17_17_41_25.trx [d:\dbs\sh\acaa\0717_171134\cmd\0\src\dirs.proj]
Problem
The failure is stemming from SetDefaultTrxFilePath computing the next available file name through IsValidIteration but does not reserve it. In case two test sessions are completing at the same time, they end up with the same trx filename, and by the time they write the results, one ends up clobbering the other.
Fix
Expect that the file gets created in IsValidIteration (and suppress the overwrite warning).
The text was updated successfully, but these errors were encountered: