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

ILLink takes a mysteriously long time to process Microsoft.Graph #87050

Closed
NickDarvey opened this issue Jun 2, 2023 · 8 comments
Closed

ILLink takes a mysteriously long time to process Microsoft.Graph #87050

NickDarvey opened this issue Jun 2, 2023 · 8 comments
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers tenet-performance Performance related issue

Comments

@NickDarvey
Copy link

Description

  1. Clone https://github.com/microsoftgraph/msgraph-sample-maui
  2. Remove bundle resource 'appSettings.Development.json' from project
  3. Run dotnet publish -c Release -f net7.0-ios16.1 -r ios-arm64

Alternatively, these alternate repros might work on Windows:

cc @vitek-karas, @filipnavara

Data

Including Microsoft.Graph.dll in the ILLink task
msbuild_.6.zip
ILLink duration: 52 mins 53 seconds

Excluding Microsoft.Graph.dll
msbuild_(7).zip
ILLink duration: 3 mins 10 seconds

Configuration

  • dotnet SDK 7.0.102
  • macOS Ventura 13.13.1
  • 2017 MacBook Pro (Intel)

Analysis

  • Microsoft.Graph.dll is only being copied/skipped by the linker, not actually trimmed.
  • The last log line I see before ILLink wanders off into the wilderness for 50 mins is
    ILLink: Cannot inline constant result of 'System.Data.DataCommonEventSource.EnterScope<T1,T2>(String, T1, T2)' call due to presence of side effects
    
    then when it resumes, the next log line is
    ILLink: Processing embedded substitution descriptor 'ILLink.Substitutions.xml' from 'System.Runtime.InteropServices, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
    
    (but I'm not sure if that's helpful if it's doing things in parallel)
  • RE: PublishTrimmed causing dotnet publish to hang #86379 (comment)
    @filipnavara, if you have any guidance on how I can profile the linker like this I'll happily do it and post the results back here.
@NickDarvey NickDarvey added the tenet-performance Performance related issue label Jun 2, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 2, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jun 2, 2023
@filipnavara
Copy link
Member

  • if you have any guidance on how I can profile the linker like this I'll happily do it and post the results back here.

No easy guidance. Although dotTrace is available on macOS it's not free. There's dotnet-trace global tool that can generate somewhat useful sample profiling.

I'd probably start with creating illink repro (https://github.com/vitek-karas/illinkrepro/) from the msbuild log file. That can be run in isolation, and it would be easier to profile.

@vitek-karas
Copy link
Member

(but I'm not sure if that's helpful if it's doing things in parallel)

Unfortunately illink is not multi-threaded - that said the output is probably not interesting, it can be really anything and the interesting bit would be which method it was processing, but that's not visible from the output.

@filipnavara filipnavara added area-Tools-ILLink .NET linker development as well as trimming analyzers and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jun 2, 2023
@ghost
Copy link

ghost commented Jun 2, 2023

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

  1. Clone https://github.com/microsoftgraph/msgraph-sample-maui
  2. Remove bundle resource 'appSettings.Development.json' from project
  3. Run dotnet publish -c Release -f net7.0-ios16.1 -r ios-arm64

Alternatively, these alternate repros might work on Windows:

cc @vitek-karas, @filipnavara

Data

Including Microsoft.Graph.dll in the ILLink task
msbuild_.6.zip
ILLink duration: 52 mins 53 seconds

Excluding Microsoft.Graph.dll
msbuild_(7).zip
ILLink duration: 3 mins 10 seconds

Configuration

  • dotnet SDK 7.0.102
  • macOS Ventura 13.13.1
  • 2017 MacBook Pro (Intel)

Analysis

  • Microsoft.Graph.dll is only being copied/skipped by the linker, not actually trimmed.
  • The last log line I see before ILLink wanders off into the wilderness for 50 mins is
    ILLink: Cannot inline constant result of 'System.Data.DataCommonEventSource.EnterScope<T1,T2>(String, T1, T2)' call due to presence of side effects
    
    then when it resumes, the next log line is
    ILLink: Processing embedded substitution descriptor 'ILLink.Substitutions.xml' from 'System.Runtime.InteropServices, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
    
    (but I'm not sure if that's helpful if it's doing things in parallel)
  • RE: PublishTrimmed causing dotnet publish to hang #86379 (comment)
    @filipnavara, if you have any guidance on how I can profile the linker like this I'll happily do it and post the results back here.
Author: NickDarvey
Assignees: -
Labels:

tenet-performance, untriaged, area-Tools-ILLink

Milestone: -

@sbomer
Copy link
Member

sbomer commented Jun 2, 2023

I was able to reproduce this behavior with the simplified repro steps at microsoftgraph/msgraph-sdk-dotnet#1811. It is the same issue that was fixed in dotnet/linker#3094. This fix isn't present in the 7.0.102 SDK - you'll need at least 7.0.302 to get the fix. I've confirmed that this SDK doesn't hit the issue.

@sbomer sbomer closed this as completed Jun 2, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jun 2, 2023
@NickDarvey
Copy link
Author

@sbomer, thank you for identifying the problem and sorry for raising an old bug.

@michaldobrodenka
Copy link

I have similar problem, still with latest SDK 7.0.302 (from 7 Preview8). When trimming, I can't build my solution (seems to take ages - I tried for 2 hours) as long as some of the csprojs are higher than net5, except main executable. So I'm using net5.0 for class libraries. Tested with SDK 7.0.302

@sbomer
Copy link
Member

sbomer commented Jun 7, 2023

@michaldobrodenka it's possible that there are other performance problems - would you mind filing a new issue? Repro steps would be helpful for us to investigate. Thanks!

@michaldobrodenka
Copy link

@sbomer I've made an issue in dotnet/sdk some time ago #87220

Unfortunately I can't publish source code to the open, but can share it to some MS engineer maybe. Or do some debugging steps if requested.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

5 participants