Maoni0 / realmon

A monitoring tool that tells you when GCs happen in a process and some characteristics about these GCs
MIT License
281 stars 25 forks source link

gcmon stops emitting GC events if a 2nd gcmon is used to monitor the first #25

Closed ryandle closed 2 years ago

ryandle commented 2 years ago
  1. Open admin console
  2. Run gcmon on a process dotnet gcmon -n <processName>
  3. Observe that it is emitting GC events / works as expected.
  4. Open a 2nd admin console
  5. Run a 2nd gcmon instance to monitor the first dotnet gcmon -p <pidOfFirstGcMonProcess>

Expected: The first gcmon process continues to work as expected and the second one reports on the 1st's GC behavior.

Actual: The first gcmon appears to stop writing gc events to the output once the 2nd starts monitoring it.

I've been able to repro this on Windows 10 20H2. Haven't tried any other platforms.

MokoSan commented 2 years ago

Could this be because the name of the session is hardcoded as MySession here and we are opening multiple of these sessions, which seems like a violation of what's described in the TraceProgrammer's Guide in this section:

"Creates a new TraceEventSession, each session is given a name that is unique ACROSS THE MACHINE. In our case we called our session MySession. Sessions CAN live beyond the lifetime of process that created them, and this name is how you refer to these sessions from other processes besides the process that created them. We also specify a file where the data is to be logged. By convention, these data files use the .ETL (Event Trace Log) suffix."

Solution: Pass in a forced unique session name via a command line argument.

Maoni0 commented 2 years ago

@MokoSan that certainly sounds like a plausible cause :)

MokoSan commented 2 years ago

Just proved that my hypothesis is true.. Will add a new command line arg for specifying the name of the session.

ryandle commented 2 years ago

If the arg is not passed by the user, could the session name be random (a guid?) to avoid collision? My reasoning is: As a user, I don’t want to have to remember to use an extra argument if I’m running more than one gcmon instance.

On Tue, Nov 23, 2021 at 10:07 PM Mukund Raghav Sharma < @.***> wrote:

Just proved that my hypothesis is true.. Will add a new command line arg for specifying the name of the session.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Maoni0/realmon/issues/25#issuecomment-977561838, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAENIH5C42DXNIDNVMYPMMDUNR6K7ANCNFSM5IUJPJUQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

MokoSan commented 2 years ago

Yup - my alternative solution was exactly along those lines.. A guid based name of a session was what I was going for. More I think about this, the more I agree with your rationale - as it is, we have enough command line args. Thanks!