Skip to content

Commit

Permalink
[tests] export $DOTNET_gcServer as 0 (#7363)
Browse files Browse the repository at this point in the history
Context: https://github.com/dotnet/linker/issues/3012
Context: https://github.com/dotnet/linker/issues/3012#issuecomment-1239958027

Occasionally, `AotTests.BuildAMassiveApp()` will fail, because the
linker crashed:

	Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
	   at Mono.Cecil.MetadataReader.RangesSize(Mono.Cecil.Range[])
	   at Mono.Cecil.MetadataReader.ReadCustomAttributes(Mono.Cecil.ICustomAttributeProvider)
	   at Mono.Cecil.Mixin+<>c.<GetCustomAttributes>b__13_0(Mono.Cecil.ICustomAttributeProvider, Mono.Cecil.MetadataReader)
	   at Mono.Cecil.ModuleDefinition.Read[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.__Canon, System.Func`3<System.__Canon,Mono.Cecil.MetadataReader,System.__Canon>)
	   at Mono.Cecil.Mixin.GetCustomAttributes(Mono.Cecil.ICustomAttributeProvider, Mono.Collections.Generic.Collection`1<Mono.Cecil.CustomAttribute> ByRef, Mono.Cecil.ModuleDefinition)
	   at Mono.Cecil.MethodDefinition.get_CustomAttributes()
	   at Microsoft.Android.Sdk.ILLink.ApplyPreserveAttribute.GetPreserveAttributes(Mono.Cecil.ICustomAttributeProvider)
	   …

The ILLink utility is run in a separate process, and is configured to
use the Server GC by default.

We believe that the `AccessViolationException` is a bug in the
Server GC, and the [suggested workaround][0] was to disable the
server GC.

Export `DOTNET_gcServer=0` so that the Server GC is disabled, in an
effort to prevent the `AccessViolationException`.

[0]: https://github.com/dotnet/linker/issues/3012#issuecomment-1237823998
  • Loading branch information
jonathanpeppers committed Sep 12, 2022
1 parent 861b5f1 commit 34986b9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build-tools/automation/yaml-templates/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@ variables:
# Workaround: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1585820
- name: _WriteTelemetryProperties
value: false
# Workaround: https://github.com/dotnet/linker/issues/3012
- name: DOTNET_gcServer
value: 0
- name: DotNetReleaseBranchPrefix
value: refs/heads/release/

0 comments on commit 34986b9

Please sign in to comment.