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

Advice for debugging hang in CreateDelegate in my DLR-based language? #277

Open
spofdamon opened this issue Nov 1, 2023 · 1 comment
Open

Comments

@spofdamon
Copy link

I'm working on a compiler for a little language and keep running into hangs when calling into the compiled delegates with DynamicInvoke. According to dotTrace 42.9% of the time below that is CreateDelegate and the rest seems to be invisible to the profiler. (I assume it's unmanaged.) I've tried pausing in the debugger at random points and ended up deep in the IL generation code somewhere.

Are there any additional debug options I can enable or tips for narrowing this down? I'm linking against debug builds of Microsoft.Dynamic.dll and Microsoft.Scripting.dll, but I think the issue might be farther down.

I'm happy to share access to the repo if anybody is interested in taking a look, but so far I haven't been able to narrow this down to a reproduction case that doesn't involve my compiler and runtime code, which is ~6k lines of C# so far.

I've attached a sample DebugView of the compiled expression tree, but it has dynamic calls back into the runtime. This tree hangs 100% of the time.
failing-expression-tree.txt

@spofdamon
Copy link
Author

spofdamon commented Nov 1, 2023

A little additional info, I've just noticed that if I pause in the debugger in the first minute or so it's still in the DLR code building the Expression tree, which is odd because it's a very short snippet of code which would normally take milliseconds to compile and execute. Waiting a few more minutes and it's beyond that into native code (below). Seems like something about my tree might be causing it to explode in runtime?

image

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

No branches or pull requests

1 participant