grafana / grafana/pyroscope-java

Sub-optimal memory leak capabilities with Pyroscope Java agent

Aperta
#94 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
126
Fork
48
Merge medio
4g 14h
PR unite (30g)
5

Descrizione

Hi,

I’m trying to use Grafana Pyroscope to find a simulated memory leak in a small example program. I have two methods called leak() and noLeak() where the leak() method saves data to a Set every time it is called and noLeak() only allocates some memory that will be garbage collected. When I use Async Profiler (2.9) locally with the –live option I see that the leak() method is “leaking” memory. When I try to use the Pyroscope agent instead (io.pyroscope:agent:0.11.3) I don’t see it nearly as clearly.
![async-large](https://user-images.githubusercontent.com/6833253/236852717-2681d10f-1a10-4e5f-9dfd-9394246e33fe.png)
![pyroscope-large](https://user-images.githubusercontent.com/6833253/236852739-ad910dbe-4ffe-42ed-90b9-a5a81edc3274.png)
![pyro-zoom](https://user-images.githubusercontent.com/6833253/236852904-e3ffc9a0-e9d8-47d6-a4aa-0cfb69561124.png)
![async-zoom](https://user-images.githubusercontent.com/6833253/236852919-bd578678-7b7e-4a6b-b047-21ecfe7b9994.png)

I used the following configuration when setting up the Pyroscope Java agent:

```
Config config = new Config.Builder()
.setApplicationName("leaktest-1")
.setFormat(Format.JFR)
.setServerAddress("http://localhost:4040/")
.setUploadInterval(Duration.ofSeconds(10))
.setProfilingEvent(EventType.ALLOC)
.setAllocLive(true)
.build();
```

When I run the async profiler, locally, for 60s or more then I can easily see the memory leak. When I run the async profiler for 10s or less than I observe the same behavior as I see with Pyroscope.
![async-10](https://user-images.githubusercontent.com/6833253/236853040-3ba087b1-75b4-40a4-8b75-b35ab8b997d9.png)

I also tried to change the upload interval of the Pyroscope Java agent to 60s, but I am still not able to see the memory leak in a good way.

Slack thread: https://grafana.slack.com/archives/C049PLMV8TB/p1683294542388929

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia con la configurazione leaktest fornita e confronta l'output ALLOC/allocLive dell'agente Java di Pyroscope con i risultati --live di Async Profiler per 10 e 60 secondi. Il lavoro è completato quando si determina perché la perdita è meno visibile oppure si documenta la limitazione e si identifica il comportamento rilevante dell'agente da modificare; non vengono indicati file o test del repository.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
observability
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
28/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.