Skip to content
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

extend logging on DeleteNoThrow #9540

Closed

Conversation

YuliiaKovalova
Copy link
Member

Context

It's an attempt to extend logging to understand the nature of this bug
#9250

Copy link
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only other thing I can think of is some sort of "shell out to lsof before/after to collect information about whether another process/user has the file open".

strace to get the low-level syscalls and their results would also be nice but I don't know of a good way to get that from within msbuild, I think it'd need to be in the calling infrastructure.

string error = process.StandardError.ReadToEnd();

process.WaitForExit();
if (!string.IsNullOrEmpty(output))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that there's a better answer for this part, but do not that this may rearrange the output and the error.

Log.LogErrorFromException(ex, showStackTrace: true, showDetail: true, destinationFileState.Name);
if (NativeMethodsShared.IsLinux)
{
Log.LogMessage($"Run lsof before DeleteNoThrow with IsIoRelatedException condition: {destinationFileState.Name}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not clear on the benefit of including this in the catches. Either it successfully ran in the try part, in which case this is just duplicate information, or it failed in the try, and there's no reason to suspect it will succeed here?

RunLsof();
}

Log.LogErrorFromException(ex, showStackTrace: true, showDetail: true, destinationFileState.Name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this is better than 'throw;' ?

}
catch
{
Log.LogWarning("lsof invocation has failed.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced at the moment that failing in this kind of logging really deserves to take a no-error, no-warning case and turn it into an error/warning case...

}
catch (Exception ex)
{
Log.LogErrorFromException(ex, showStackTrace: true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this?

@Forgind
Copy link
Member

Forgind commented Dec 21, 2023

Also, have you tried to measure the performance of this? I suspect that building ~anything that includes overwriting a bunch of files will suddenly be very slow with this change as-is.

@YuliiaKovalova
Copy link
Member Author

Also, have you tried to measure the performance of this? I suspect that building ~anything that includes overwriting a bunch of files will suddenly be very slow with this change as-is.

This is a draft PR just for collecting more logs for the existing problem on App Services specifically. The sdk with the patched msbuild was already given to the team which experiences this error. Of course, we don't plan to merge these changes, but that you for your comments in any case :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants