Dr-dotnet - 🩺 One-click diagnosis of your dotnet applications. Works both locally or remotely as a web service

Overview

Dr-Dotnet 🩺

🚧 Very WIP 😉

The goal is to create a profiler that would ease the tracking of common issues in .NET applications such as deadlocks, cpu hotpaths, zombie threads, async hotpaths (stuck tasks), memory leaks.
It is possible to identify some of these issues using today's existing tools, but with some drawbacks:

  • Often you have to explicitely look for such issue.
  • Such tools rarely have a good user experience. Appart from dotMemory, I find UX considerations to be often left appart.
  • In many cases the tracing/profiling has a noticable impact on the runtime and add bias to the profiling results.

The .NET Profiling API is accessible via COM interop (cross-platform thanks to the Platform Adaptation Layer) and allows little overheap profiling compared to other methods while giving a wide range of possibilities for profiling purpose. Perfview uses this API (on top of ETW) however it does it from managed code calling mocked COM objects written in C#. For the project, the idea would be to do it in C++ or even better in Rust (ideally Rust + including CoreCLR headers in kind of a hybrid fashion, if that is possible). Then the offline tooling (UI) can be in C# or any other "productive" language.

Todo

  • Manage to initialize at start
  • Manage to initialize on attach
  • Write profiler POC in rust
  • Add a functional build flow (profiler + attacher)
  • Figure out what I really want feature-wise
    • Should I even consider attach mode? (because of its limitations)
    • Should I even consider start mode? (because it is too invasive and implies process restart, which is bad is issue is live)
  • Implement IPC through Event Pipe
  • Add simple UI client for attaching
  • Add simple UI client for setting up on-start profiler
  • Create web app profiler UI that can work in headless scenarios (eg. linux servers)
  • Have web app profiler work when used as a sidecar docker container
  • Use ffidji to have an interface to share profiler specifications between profilers lib and UI
    • For each profiler: Name, Guid, Description, Duration, Parameters (blob?)
  • Find out analysis format
    • What kind of data should it hold? Summary of analysis or should it allow some kind of browsing?
    • json? yaml? custom?

Possibilities

  • On object allocated with ObjectAllocated COR_PRF_MONITOR_OBJECT_ALLOCATED ⚠️
  • Object reference is moved during garbage collection with MovedReferences COR_PRF_MONITOR_GC
  • Build reference tree after a GC run with ObjectReferences COR_PRF_MONITOR_GC
  • Object instance allocation per class with ObjectsAllocatedByClass COR_PRF_MONITOR_GC
  • Unmanaged code called from managed code COR_PRF_MONITOR_CODE_TRANSITIONS ⚠️
  • Get surviving references after garbage collection COR_PRF_MONITOR_GC SurvivingReferences2
  • On runtime suspended / resumed COR_PRF_MONITOR_SUSPENDS RuntimeSuspendStarted
  • On garbage collection started / finished COR_PRF_MONITOR_GC
  • On thread created COR_PRF_MONITOR_THREADS
  • On exception thrown COR_PRF_MONITOR_EXCEPTIONS
  • On method enter / leave with SetEnterLeaveFunctionHooks3WithInfo COR_PRF_MONITOR_ENTERLEAVE ⚠️
  • Write to event pipe
  • Request stacktrace (per thread) COR_PRF_ENABLE_STACK_SNAPSHOT
  • Annnnd a lot more :p... COR_PRF_MONITOR_GC

Profiler is initialized on application start

Any flag from COR_PRF_MONITOR enumeration.

Profiler is initialized on attach

Only possible on a subset of COR_PRF_MONITOR enumeration:

  • COR_PRF_MONITOR_THREADS
  • COR_PRF_MONITOR_MODULE_LOADS
  • COR_PRF_MONITOR_ASSEMBLY_LOADS
  • COR_PRF_MONITOR_APPDOMAIN_LOADS
  • COR_PRF_ENABLE_STACK_SNAPSHOT
  • COR_PRF_MONITOR_GC
  • COR_PRF_MONITOR_SUSPENDS
  • COR_PRF_MONITOR_CLASS_LOADS
  • COR_PRF_MONITOR_EXCEPTIONS
  • COR_PRF_MONITOR_JIT_COMPILATION
  • COR_PRF_ENABLE_REJIT

Useful Links

You might also like...
Provides utility functions to perform a graceful shutdown on an tokio-rs based service

tokio-graceful-shutdown IMPORTANT: This crate is in an early stage and not ready for production. This crate provides utility functions to perform a gr

Ultralight, security-first service mesh for Kubernetes. Main repo for Linkerd 2.x.
Ultralight, security-first service mesh for Kubernetes. Main repo for Linkerd 2.x.

Linkerd 🎈 Welcome to Linkerd! 👋 Linkerd is an ultralight, security-first service mesh for Kubernetes. Linkerd adds critical security, observability,

The Dutch secret service (AIVD) has a yearly puzzle challenge around Christmas
The Dutch secret service (AIVD) has a yearly puzzle challenge around Christmas

AIVD kerstpuzzel 2021 18 solver The Dutch secret service (AIVD) has a yearly puzzle challenge around Christmas, called the 'AIVD kerstpuzzel'. This re

mutex-as-a-service

MAAS (Mutex-As-A-Service) I honestly don't know why I made this, but here it is. Here are some docs: Api docs Api docs were generated with this: https

Framework is a detector for different frameworks in one projects

Framework is a detector for different frameworks in one projects Usage use

Annotation to easily define ad-hoc / one-shot extension traits

Annotation to easily define ad-hoc / one-shot extension traits

Openfare - Monetize software with one commit.
Openfare - Monetize software with one commit.

OpenFare 🪙 Monetize software with one commit. 🪙 OpenFare monetizes any software library with one code change. The goal: fund the next million softwa

✨🥞The magic pancakes cli currently supports one command

✨ 🥞 Magic Pancakes The magic pancakes cli currently supports one command: $ pancakes generate Installing $ cargo build --release $ cargo install --pa

1️⃣ el lisp number uno - one lisp to rule them all 🏆

luno el lisp number uno luno is the one lisp to rule them all. Still experimental, do not use it in production yet. goals embeddable small size simple

Owner
Olivier Giniaux
Software Engineer / Creative Coder
Olivier Giniaux
Quickly mint NFT(able)s port forwards remotely

Easy expose A really simple way to expose some service behind a NAT, similar to rathole and frp. WARNING: This does not secure the channel, or even do

Ben Simms 3 Dec 3, 2022
Wait Service is a pure rust program to test and wait on the availability of a service.

Wait Service Wait Service is a pure rust program to test and wait on the availability of a service.

Magic Len (Ron Li) 3 Jan 18, 2022
Open-source Rewind.ai clone written in Rust and Vue running 100% locally with whisper.cpp

mind-overflow Open-source Rewind.AI clone built with Tauri and Vue. Leverages whisper.cpp for Speech-to-Text and (wip: llama.cpp for Text generation a

Maxime Dolores 4 Aug 9, 2023
Transmute - a binary that works alone or in coordination with coverage formatter to report test quality

Transmute is a binary that works alone or in coordination with coverage formatter to report test quality. It will change your code and make the tests fail. If don't, we will raise it for you.

Victor Antoniazzi 5 Nov 17, 2022
This contract is to provide vesting account feature for the both cw20 and native tokens, which is controlled by a master address

Token Vesting This contract is to provide vesting account feature for the both cw20 and native tokens, which is controlled by a master address. Instan

yys 7 Oct 7, 2022
UnTeX is both a library and an executable that allows you to manipulate and understand TeX files.

UnTeX UnTeX is both a library and an executable that allows you to manipulate and understand TeX files. Usage Executable If you wish to use the execut

Jérome Eertmans 1 Apr 5, 2022
A tool to run web applications on AWS Lambda without changing code.

AWS Lambda Adapter A tool to run web applications on AWS Lambda without changing code. How does it work? AWS Lambda Adapter supports AWS Lambda functi

AWS Samples 321 Jan 2, 2023
A service for helping your cat find other cats

Check back later! Discord Self-hosting This is an open-source service! Feel free to host you own private instances. All we ask is you credit us and li

ibx34 4 Oct 31, 2021
Build your service-server fast, easy (and without hosting!)

service-io is a library to build servers that offering services with really little effort. Choose an input connector. Choose an output connector. Choo

Luis Enrique Muñoz Martín 34 Jan 4, 2023
Rust client for AWS Infinidash service.

AWS Infinidash - Fully featured Rust client Fully featured AWS Infinidash client for Rust applications. You can use the AWS Infinidash client to make

Rafael Carício 15 Feb 12, 2022