-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[9.0.100-preview.7.24375.12] Markdig nuget package thrown "The parser is in an invalid infinite loop while trying to parse inlines for block..." exception when parsering markdown string to html #105792
Comments
@mkArtakMSFT Could you help look at this bug and help triage it? In the meantime, could you please help confirm if this is a blocker for .NET 9 Preview 7? Please help move to correct team if it is not correct. Thanks. |
@Junjun-zhao based on the source of the call stack this doesn't seem blazor specific. The exception is coming from a third-party component.
|
Yes @javiercn , the call stack seem come from Markdig nuget package, but this is a behavior change from dotnet-sdk-9.0.100-preview.7.24375.12 as it passed on dotnet-sdk-9.0.100-preview.7.24371.4. Could you please look into what change caused this? |
Thanks for reaching out, @Junjun-zhao. In order for us to investigate this further, we need a minimal repro project that doesn't utilize third-party code. |
@MackinnonBuck we are the .NET AppCompat team and we test 3rd Party apps with latest runtime to log bugs. We try to provide minimal repros wherever possible, but we might not have the expertise to create minimal repro without using 3rd party code. We have provided a repro machine with the two apps that are showing a change in behavior. We would need help from ASPNET Core team to look at the repro machine provided and investigate to root cause the change in behavior - probably review what changes have been made in this space recently that could have introduced the regression. |
@MackinnonBuck During our further investigation, we found this issue also reproduces with a console app. We tried to reference the Markdig (version 0.37.0) source code instead of installing it from nuget package manager, it doesn't repro in debug mode. But if we enable Update the Minimal repro steps with console project: (repro demo attachedDemoForMarkdownToHtml.zip):
Expected Result: Actual Result:
|
@Junjun-zhao thanks for the additional details. This seems to be a regression somewhere in the runtime. I'm transferring the issue |
Tagging subscribers to this area: @dotnet/area-system-runtime |
Thanks @jeffschwMSFT for helping check this issue. Could you please help confirm if this is a blocker for .NET 9 Preview7? |
It would need investigation. @jeffhandley could y'all take a look? It looks like a 3rd party nuget break, but perhaps we had a subtle change causing the break. |
I was able to pinpoint to #104752 as a source of regression (f455188). This was done by doing semi-manual (rejecting obviously not culprits and repro requires refreshing the page) binary search between commits 1f70f0c and eedf30e. I had to do it twice because first time I was getting AVs caused by #104336 and then had to do it second time with revert of that commit - the AV is already reverted by #105234 though. I tried to run original repro after reverting #104752 but I hit non-obvious merge conflict and it's already end of the day for me so will leave it here. I didn't have much luck narrowing down the repro (other than removing Counter page and putting MarkDownToComponent directly in the Index but that also causes you need to refresh a bit more than 7 times) - it seems to be somewhere between Razor and Markdig - I've tried isolating Markdig piece (i.e. stressed this under multiple threads) but without luck and I'm not familiar with Razor enough to simplify this further quickly. |
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Using the standalone repro the issue is in the codegen for
This method has phi-refinements but does not leverage them for copyprop. Will need to dig in to see where things change. |
Here's a simple repro case // DOTNET_TieredCompilation=0
// Should return 100, but returns 99
using System.Runtime.CompilerServices;
class Runtime_105792
{
[MethodImpl(MethodImplOptions.NoInlining)]
static int Problem(int x)
{
int y = 0;
while (x != 0)
{
if (y == x) return -1;
y = x;
Update(ref x);
}
return x;
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Update(ref int x)
{
x = x - 1;
}
public static int Main() => 100 + Problem(10);
}
Phi refinement kicks in for the while loop in This enables RBO to decide that if we come along the loop back edge, we know that
Not sure how to fix this. Seems like we might need to do something similar to hoisting here, where we realize that a VN is loop dependent? @dotnet/jit-contrib any thoughts? |
Hmm yeah, I agree, I think the refinement can only be done with VNs that we can prove to be invariant in the loop we are refining for. Otherwise the same VN can take on different values, as in this example. |
PhiArg VNs should be invariant in the loop that contains the Phi, otherwise the same VN may refer to values from more than one iteration. Fixes dotnet#105792.
Verified this issue with dotnet-sdk-9.0.100-rc.1.24417.9, it has been fixed. |
PhiArg VNs should be invariant in the loop that contains the Phi, otherwise the same VN may refer to values from more than one iteration. Fixes dotnet#105792.
Is there an existing issue for this?
Describe the bug
When running 3rd part application with the latest .NET 9 build, BlazorStrap and Blog apps failed load page content during switching pages in applications. And the command prompt window throws
"The parser is in an invalid infinite loop while trying to parse inlines for block [ParagraphBlock] at position ($0, 0, 0-107" exception
.Application Name: BlazorStrap, Blog, OpenBullet2
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-9.0.100-preview.7.24375.12
App or App Source checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2174456
Github Link:
https://github.com/chanan/BlazorStrap
https://github.com/sagebind/blog
Verify Scenarios:
1). Windows 10 21H2 AMD64 + dotnet-sdk-8.0.303: Pass
2). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.7.24371.4: Pass
3). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.7.24375.12: Fail
Expected Behavior
Switch back from "Shared Parameters" to "Contribute" successfully.
Steps To Reproduce
The machine has dotnet-sdk-9.0.100-preview.7.24375.12 installed.
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "9.0.0-preview.7.24374.12"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "9.0.0-preview.7.24373.9"
}
],
Exceptions (if any)
Actual Result:
Switch back from "Shared Parameters" to "Contribute" failed.
Stack Trace from Command Prompt:
.NET Version
9.0.100-preview.7.24375.12
Anything else?
Minimal Repro steps (repro demo attached
MarkdownToHtmlDemo.zip):
1.Create a Blazor Server App project.
2. Install Markdig nuget package.
3. Add a MarkdownToComponent.cs class file with following content:
Expected Result:
The Counter page refresh 7 time successfully.
Actual Result:
The Counter page refresh failed at the 7th refresh with following error:
Findings:
@dotnet-actwx-bot @dotnet/compat
The text was updated successfully, but these errors were encountered: