JProfiler "Recorded Objects" shows different results with/without System.gc even though session settings say to record "Live and GCed objects" - jprofiler

My session settings tell JProfiler to record "Live an GCed objects". I configured the session to start recording "Allocation data" at VM startup. Recording is stopped at VM exit.
When I run my test, "Recorded Objects" shows about 8 mio allocations, 500MB in size. If I add a System.gc() at the end of the test, the "Recorded Objects" drop to 800k allocations, 135MB in size.
Why's that so? I assumed to see the whole object throughput in "Recorded Objects" if I tell JProfiler to record GCed objects as well.

Switch the "Liveness mode" to "Live and garbage collected objects":

Related

Tens of thousands of htm files in c:\Temp

VS 2022 creates tens of thousands of htm-files (obviuosly log-files) in c:\Temp\Default and c:\Temp\NativeImage.
After a couple of weeks of work with VS they add upp to several GB. This slows down work as the Virus scanner will take all cpu for several minutes after starting VS.
Deleting those folders and I'm back to normal for a week or so. And is not good for my SSD.
What can be done to prevent this?
I havn't seen this with VS2019 or early versions of VS2022.
From your comment, this sounds like logs from the Fusion Log Viewer. Double-check your settings by running fuslogvw.exe from an elevated command prompt (need to be elevated to change settings).
If you have enabled either of the last 2 options (Log bind failures to disk or Log all binds to disk), it will create a log file for each applicable event. This can end up consuming lots of disk space, as you're observing.
If you set it to the second option (Log in exception text), you'll be able to view these details in the debugger if you're encountering assembly bind failures, but it doesn't write to disk anywhere (just a slight memory increase in the exception objects).

EventLog Listener Suddenly Parses ENTIRE Security Log

I have a humble VB.Net forms app with a listener for the Windows security log. It's configured such that whenever a network login succeeds or fails (Event ID 4624/5, Logon Type 3), it records the associated source IP and username used to log in, printing these (with the program's own timestamp) to my output log form.
It works great - until, for no reason that I can clearly ascertain, the program suddenly reads my entire Windows Security log and dumps every single "matching" event that has ever happened into the form – which promptly crashes the program (freezes it actually, but I kill it first... it takes a loooong time to finish when this happens).
Now, upon examining the output one such occurrence, the timestamps DON'T match the actual event log. They start at the time that the program "panics" and reads the entire log from beginning to end. So an event that happened two days ago has a timestamp from today in the program, because that's when the program "read" the data.
But, how in the world is this happening when the EntryWritten event should only be raised when each event is actually added? It's like every single entry in the log is suddenly a "New Entry" all over again. This seems to only occur on my Windows 10 PC, and NOT on my Windows Server 2019 machine.
Possible trigger (or at least synchronous) events have included:
Logging into a shared folder on this machine from another machine
Logging into RDP on another machine from this machine
Opening a website in Microsoft Edge
I'm totally lost here; I don't even know if this is a Stack Overflow question or a Super User question... but since cross-posting is frowned upon, I'll start here. Also worth noting, no new event is even added when this happens. It stops at exactly where the log was at when the flood started; actually new events that occur after the flood begins do not seem to get included in the flood. (I may be wrong about this, but I don't have a reliable way of checking - the above methods are not repeatable, unfortunately.)
Update: I can with 100% reliability induce the "Event Recall Flood" by repeatedly failing an RDP login from the machine in question to another machine. Not sure why this is causing every event in the Security log to fire the EntryWritten event though...
The Security event log (probably the others as well) in Windows 10 (Ver. 1909 Build 18363.778) will "reprocess" the entire log when it hits capacity and is trimmed, causing all remaining events in the log to display themselves as "new events" to any attached EventLog listeners, resulting in a flood of EventWritten triggers that will hang an application if the log is sizable. (Min. size is 20Mb as of this writing, about ~31,000 events... so yeah.)
This effect can be curtailed: (1) temporarily, by emptying the log; or (2) more permanently, by configuring the log to "Archive the log when full, do not overwrite events."
Huge thank you to Andrew Morton for the spot-on tips on where to look! As he mentioned in his comments, this "seems like a bug." It has now been reported to Microsoft Feedback Hub with documentation.

Google Compute Engine VM constantly crashes

On the Compute Engine VM in us-west-1b, I run 16 vCPUs near 99% usage. After a few hours, the VM automatically crashes. This is not a one-time incident, and I have to manually restart the VM.
There are a few instances of CPU usage suddenly dropping to around 30%, then bouncing back to 99%.
There are no logs for the VM at the time of the crash. Is there any other way to get the error logs?
How do I prevent VMs from crashing?
CPU usage graph
This could be your process manager saying that your processes are out of resources. You might wanna look into Kernel tuning where you can increase the limits on the number of active processes on your VM/OS and their resources. Or you can try using a bigger machine with more physical resources. In short, your machine is falling short on resources and hence in order to keep the OS up, process manager shuts down the processes. SSH is one of those processes. Once you reset the machine, all comes back to normal.
How process manager/kernel decides to quit a process varies in many ways. It could simply be that a process has consistently stayed up for way long time to consume too many resources. Also, one thing to note is that OS images that you use to create a VM on GCP is custom hardened by Google to make sure that they can limit malicious capabilities of processes running on such machines.
One of the best ways to tackle this is:
increase the resources of your VM
then go back to code and find out if there's something that is leaking in the process or memory
if all fails, then you might wanna do some kernel tuning to make sure your processes have higer priority than other system process. Though this is a bad idea since you could end up creating a zombie VM.

JProfiler, Want to store data measurment in disk automaticly without using JProfiler GUI?

I use JProfiler to measure Memory used, CPU and Garbage collection for my application. I can see all those measurement in JProfiler GUI. Also I am able to store data for all mentioned measurements in disk after finishing the test using options in GUI in order to generate a nice report using excel for example.
But I want to do the same task automatically, for example when the test complete I want to store all measurement automatically in disk without using GUI.
Any help?
Thank you
Ibrahim
This is done with offline profiling.
In the "Triggers" section of the session settings, you can set up triggers that are executed for certain events, such as entry / exit of selected methods, timers, low heap / high CPU conditions, JVM start and exit and others.
Each trigger has a list of actions that control the profiling agent. Among other things, they can start and stop recording and save snapshots.
You can then export data from the saved snapshots programmatically with the command line utility jpexport.

Automatically taking thread dumps or heap dumps

I'm trying to monitor a Java Application over a long period of time.
I want to automatically take a Thread dump or Heap Dump if number of threads or Heap exceeds some threshold.
Is this functionality available via VisualVM or Mission Control or other profiling tool?
Start the JMX Console in Java Mission Control
Go to the Triggers tab and select trigger rule "Thread Count" or "Live Set". You can select threshold and action to take. If running JDK 8, I think you can invoke a diagnostic command, such as Thread.print. It's also possible to dump a Flight Recording, which contains thread dumps among many other things.