runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Test failure: ConsoleEncoding.TestEncoding - NotSupportedException : Memory stream is not expandable

Open karelz opened this issue 3 years ago • 2 comments

Test affected:

  • ConsoleEncoding.TestEncoding

Occurrences 4/5-8/7 (incl. PRs) from Kusto (see query below) or Runfo last 120 days: (average 1 failure per week)

Day Run OS
8/7 Rolling run Debian.10.Amd64 - Mono Interpreter
8/5 PR #73482 Debian.10.Amd64 - Mono Interpreter
7/26 PR #72817 Debian.10.Amd64 - Mono Interpreter
7/26 PR #72865 Debian.10.Amd64 - Mono Interpreter
7/20 PR #72154 Debian.10.Amd64 - Mono Interpreter
7/19 PR #72416 Debian.10.Amd64 - Mono Interpreter
7/14 PR #72126 Debian.10.Amd64 - Mono Interpreter
6/14 PR #70731 Debian.10.Amd64 - Mono Interpreter
6/14 PR #70705 Debian.10.Amd64 - Mono Interpreter
5/30 Rolling run Debian.10.Amd64 - Mono Interpreter

Test output: (fails on different strings in different runs)

    ConsoleEncoding.TestEncoding(inputString: "This is Ascii string") [FAIL]
      System.NotSupportedException : Memory stream is not expandable.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/IO/MemoryStream.cs(272,0): at System.IO.MemoryStream.set_Capacity(Int32 value)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/MemoryStream.cs(156,0): at System.IO.MemoryStream.EnsureCapacity(Int32 value)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/MemoryStream.cs(665,0): at System.IO.MemoryStream.Write(ReadOnlySpan`1 buffer)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/StreamWriter.cs(315,0): at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/StreamWriter.cs(208,0): at System.IO.StreamWriter.Dispose(Boolean disposing)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/TextWriter.cs(65,0): at System.IO.TextWriter.Dispose()
        /_/src/libraries/System.Console/tests/ConsoleEncoding.cs(55,0): at ConsoleEncoding.TestEncoding(String inputString)
        /_/src/mono/System.Private.CoreLib/src/System/Reflection/MethodInvoker.Mono.cs(33,0): at System.Reflection.MethodInvoker.InterpretedInvoke(Object obj, Span`1 args, BindingFlags invokeAttr)
let failedTests = (testNameSubstring : string, methodName : string, messageSubstr: string, includePR : bool, includePassedOnRerun : bool) {
cluster('engsrvprod.kusto.windows.net').database('engineeringdata').AzureDevOpsTests
    | where TestName contains testNameSubstring
    | where includePassedOnRerun or (Outcome == 'Failed')
    | extend startOfTestName = indexof_regex(TestName, @"[^.]+$")
    | extend Method = substring(TestName, startOfTestName)
    | extend Type = substring(TestName, 0, startOfTestName - 1)
    | project-away startOfTestName
    | where (methodName == '') or (Method == methodName)
    | where Message contains messageSubstr
    | distinct JobId, WorkItemId, Message, StackTrace, Method, Type, Arguments, Outcome
    | join kind=inner (cluster('engsrvprod.kusto.windows.net').database('engineeringdata').Jobs
        | where ((Branch == 'refs/heads/main') or (Branch == 'refs/heads/master') or (includePR and (Source startswith "pr/")))
        | where Type startswith "test/functional/cli/"
            and not(Properties contains "runtime-staging")
        | summarize arg_max(Finished, Properties, Type, Branch, Source, Started, QueueName) by JobId
        | project-rename JobType = Type) on JobId
    | extend PropertiesJson = parse_json(Properties)
    | extend OS = replace_regex(tostring(PropertiesJson.operatingSystem), @'\((.*)\).*|([^\(].*)', @'\1\2')
    | extend Runtime = iif(PropertiesJson.runtimeFlavor == "mono", "Mono", iif(PropertiesJson.DefinitionName contains "coreclr", "CoreCLR", ""))
    | extend TargetBranch = extractjson("$.['System.PullRequest.TargetBranch']", Properties)
    | extend Architecture = PropertiesJson.architecture
    | extend Scenario = iif(isempty(PropertiesJson.scenario), "--", PropertiesJson.scenario)
    //| extend DefinitionName = PropertiesJson.DefinitionName
    | project-away PropertiesJson
};
failedTests(
    '', //testNameSubstring
    'TestEncoding', //methodName
    'Memory stream is not expandable', //messageSubstr
    true,  //includePR
    true); //includePassedOnRerun

karelz avatar Aug 07 '22 18:08 karelz

Tagging subscribers to this area: @dotnet/area-system-console See info in area-owners.md if you want to be subscribed.

Issue Details

Occurrences 4/5-8/7 (incl. PRs) from Kusto (see query below) or Runfo last 120 days: (average 1 failure per week)

Day Run OS
8/7 Rolling run Debian.10.Amd64 - Mono Interpreter
8/5 PR #73482 Debian.10.Amd64 - Mono Interpreter
7/26 PR #72817 Debian.10.Amd64 - Mono Interpreter
7/26 PR #72865 Debian.10.Amd64 - Mono Interpreter
7/20 PR #72154 Debian.10.Amd64 - Mono Interpreter
7/19 PR #72416 Debian.10.Amd64 - Mono Interpreter
7/14 PR #72126 Debian.10.Amd64 - Mono Interpreter
6/14 PR #70731 Debian.10.Amd64 - Mono Interpreter
6/14 PR #70705 Debian.10.Amd64 - Mono Interpreter
5/30 Rolling run Debian.10.Amd64 - Mono Interpreter
let failedTests = (testNameSubstring : string, methodName : string, messageSubstr: string, includePR : bool, includePassedOnRerun : bool) {
cluster('engsrvprod.kusto.windows.net').database('engineeringdata').AzureDevOpsTests
    | where TestName contains testNameSubstring
    | where includePassedOnRerun or (Outcome == 'Failed')
    | extend startOfTestName = indexof_regex(TestName, @"[^.]+$")
    | extend Method = substring(TestName, startOfTestName)
    | extend Type = substring(TestName, 0, startOfTestName - 1)
    | project-away startOfTestName
    | where (methodName == '') or (Method == methodName)
    | where Message contains messageSubstr
    | distinct JobId, WorkItemId, Message, StackTrace, Method, Type, Arguments, Outcome
    | join kind=inner (cluster('engsrvprod.kusto.windows.net').database('engineeringdata').Jobs
        | where ((Branch == 'refs/heads/main') or (Branch == 'refs/heads/master') or (includePR and (Source startswith "pr/")))
        | where Type startswith "test/functional/cli/"
            and not(Properties contains "runtime-staging")
        | summarize arg_max(Finished, Properties, Type, Branch, Source, Started, QueueName) by JobId
        | project-rename JobType = Type) on JobId
    | extend PropertiesJson = parse_json(Properties)
    | extend OS = replace_regex(tostring(PropertiesJson.operatingSystem), @'\((.*)\).*|([^\(].*)', @'\1\2')
    | extend Runtime = iif(PropertiesJson.runtimeFlavor == "mono", "Mono", iif(PropertiesJson.DefinitionName contains "coreclr", "CoreCLR", ""))
    | extend TargetBranch = extractjson("$.['System.PullRequest.TargetBranch']", Properties)
    | extend Architecture = PropertiesJson.architecture
    | extend Scenario = iif(isempty(PropertiesJson.scenario), "--", PropertiesJson.scenario)
    //| extend DefinitionName = PropertiesJson.DefinitionName
    | project-away PropertiesJson
};
failedTests(
    '', //testNameSubstring
    'TestEncoding', //methodName
    'Memory stream is not expandable', //messageSubstr
    true,  //includePR
    true); //includePassedOnRerun
Author: karelz
Assignees: -
Labels:

area-System.Console, os-linux, runtime-mono

Milestone: -

msftbot[bot] avatar Aug 07 '22 18:08 msftbot[bot]

When test hits this exception it should log the code page, input encoding and BOM. It's quite curious it's sporadic and on random strings. Something non deterministic/racy.

danmoseley avatar Aug 07 '22 20:08 danmoseley

Tagging subscribers to this area: @brzvlad See info in area-owners.md if you want to be subscribed.

Issue Details

Test affected:

  • ConsoleEncoding.TestEncoding

Occurrences 4/5-8/7 (incl. PRs) from Kusto (see query below) or Runfo last 120 days: (average 1 failure per week)

Day Run OS
8/7 Rolling run Debian.10.Amd64 - Mono Interpreter
8/5 PR #73482 Debian.10.Amd64 - Mono Interpreter
7/26 PR #72817 Debian.10.Amd64 - Mono Interpreter
7/26 PR #72865 Debian.10.Amd64 - Mono Interpreter
7/20 PR #72154 Debian.10.Amd64 - Mono Interpreter
7/19 PR #72416 Debian.10.Amd64 - Mono Interpreter
7/14 PR #72126 Debian.10.Amd64 - Mono Interpreter
6/14 PR #70731 Debian.10.Amd64 - Mono Interpreter
6/14 PR #70705 Debian.10.Amd64 - Mono Interpreter
5/30 Rolling run Debian.10.Amd64 - Mono Interpreter

Test output: (fails on different strings in different runs)

    ConsoleEncoding.TestEncoding(inputString: "This is Ascii string") [FAIL]
      System.NotSupportedException : Memory stream is not expandable.
      Stack Trace:
        /_/src/libraries/System.Private.CoreLib/src/System/IO/MemoryStream.cs(272,0): at System.IO.MemoryStream.set_Capacity(Int32 value)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/MemoryStream.cs(156,0): at System.IO.MemoryStream.EnsureCapacity(Int32 value)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/MemoryStream.cs(665,0): at System.IO.MemoryStream.Write(ReadOnlySpan`1 buffer)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/StreamWriter.cs(315,0): at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/StreamWriter.cs(208,0): at System.IO.StreamWriter.Dispose(Boolean disposing)
        /_/src/libraries/System.Private.CoreLib/src/System/IO/TextWriter.cs(65,0): at System.IO.TextWriter.Dispose()
        /_/src/libraries/System.Console/tests/ConsoleEncoding.cs(55,0): at ConsoleEncoding.TestEncoding(String inputString)
        /_/src/mono/System.Private.CoreLib/src/System/Reflection/MethodInvoker.Mono.cs(33,0): at System.Reflection.MethodInvoker.InterpretedInvoke(Object obj, Span`1 args, BindingFlags invokeAttr)
let failedTests = (testNameSubstring : string, methodName : string, messageSubstr: string, includePR : bool, includePassedOnRerun : bool) {
cluster('engsrvprod.kusto.windows.net').database('engineeringdata').AzureDevOpsTests
    | where TestName contains testNameSubstring
    | where includePassedOnRerun or (Outcome == 'Failed')
    | extend startOfTestName = indexof_regex(TestName, @"[^.]+$")
    | extend Method = substring(TestName, startOfTestName)
    | extend Type = substring(TestName, 0, startOfTestName - 1)
    | project-away startOfTestName
    | where (methodName == '') or (Method == methodName)
    | where Message contains messageSubstr
    | distinct JobId, WorkItemId, Message, StackTrace, Method, Type, Arguments, Outcome
    | join kind=inner (cluster('engsrvprod.kusto.windows.net').database('engineeringdata').Jobs
        | where ((Branch == 'refs/heads/main') or (Branch == 'refs/heads/master') or (includePR and (Source startswith "pr/")))
        | where Type startswith "test/functional/cli/"
            and not(Properties contains "runtime-staging")
        | summarize arg_max(Finished, Properties, Type, Branch, Source, Started, QueueName) by JobId
        | project-rename JobType = Type) on JobId
    | extend PropertiesJson = parse_json(Properties)
    | extend OS = replace_regex(tostring(PropertiesJson.operatingSystem), @'\((.*)\).*|([^\(].*)', @'\1\2')
    | extend Runtime = iif(PropertiesJson.runtimeFlavor == "mono", "Mono", iif(PropertiesJson.DefinitionName contains "coreclr", "CoreCLR", ""))
    | extend TargetBranch = extractjson("$.['System.PullRequest.TargetBranch']", Properties)
    | extend Architecture = PropertiesJson.architecture
    | extend Scenario = iif(isempty(PropertiesJson.scenario), "--", PropertiesJson.scenario)
    //| extend DefinitionName = PropertiesJson.DefinitionName
    | project-away PropertiesJson
};
failedTests(
    '', //testNameSubstring
    'TestEncoding', //methodName
    'Memory stream is not expandable', //messageSubstr
    true,  //includePR
    true); //includePassedOnRerun
Author: karelz
Assignees: -
Labels:

area-System.Console, os-linux, untriaged, area-Codegen-Interpreter-mono, runtime-mono

Milestone: -

msftbot[bot] avatar Aug 09 '22 07:08 msftbot[bot]

moving to 8.0.0 given it's non-deterministic. Will investigate and propose a backport if we narrow down the issue

SamMonoRT avatar Aug 09 '22 14:08 SamMonoRT

I'm not getting hits on recent runs, and Build Analyis tool hasn't picked up hits either. Intentionally closing it, so it get re-opened on next hit to investigate further. https://runfo.azurewebsites.net/search/tests/?q=started%3A%7E14+definition%3Aruntime+name%3A%22consoleencoding.testencoding%22

SamMonoRT avatar Aug 03 '23 14:08 SamMonoRT