Commit cc77173
authored
Trace2FileWriter: ignore some exceptions on write (#1340)
These exceptions were discovered while exploring trace2 settings with a
full Git client.
Git can take a directory location as a trace2 target and will create new
files for every process. GCM currently throws a
DirectoryNotFoundException given such a parameter.
Git processes somehow can append to the same file across multiple
subprocesses. When GCM attempts to append to the file, it gets an
UnauthorizedAccessException on Windows due to multiple writers being
problematic. This exception could also happen on other platforms if the
setting is pointing to a file with restricted permissions.
In both of these cases, we chose to do nothing. The traces are lost, but
that's better than crashing the process.
Future directions could include:
1. Sending a warning over stderr if these exceptions occur, to make it
clear why trace2 are not showing up.
2. Directories could be noticed as a different kind of trace target and
we create a new file for the process before passing it to the
Trace2FileWriter.
3. Perhaps there is a way for Git to pass the handle to the trace file
so we can append to the file that Git was using. (Alternatively, Git
could close the file and then reopen it after running the GCM
subprocess.)
Each of these issues are a bit complicated, so this quick fix is chosen
as a stop gap to avoid this problem for current users.File tree
1 file changed
+18
-1
lines changed1 file changed
+18
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
17 | 34 | | |
18 | 35 | | |
0 commit comments