sentry-elixir icon indicating copy to clipboard operation
sentry-elixir copied to clipboard

`Sentry.Transport.Sender` can use a lot of memory

Open hkrutzer opened this issue 1 year ago • 3 comments

Environment

v10.6.2

Steps to Reproduce

This is memory usage with our base config:

Image

In absolute terms it is not that much memory, but it can go up to around 20MB and often appears in our top 20 of processes using the most memory. Manually triggering a garbage collection on the process reduces it by a lot.

I enabled source maps, which took it up to this:

Image

and eventually caused our application to be OOM-killed.

The source map file is not that big:

Wrote 1412 files in 1.54 Mb to: _build/dev/lib/sentry/priv/sentry.map

Loading it manually with :erlang.binary_to_term:

iex(11)> byte_size(sourcemap)
1307912

I realise there are not many details in this issue but I'm not sure what to add. Please let me know what additional info you need.

hkrutzer avatar Aug 19 '24 15:08 hkrutzer

Mh this is definitely an issue but yeah it could take a while to debug, I'll try to look into it.

whatyouhide avatar Aug 19 '24 16:08 whatyouhide

@hkrutzer what's your error throughput that you are reporting to Sentry here? The issue with source maps will be fixed in master soon, but 20MB can be quite high unless your throughput is high.

whatyouhide avatar Aug 28 '24 09:08 whatyouhide

Not that high:

Image

(I'm assuming errors includes warnings, if not it might be 2 to 3 times as much, which is still not that high I would say).

hkrutzer avatar Aug 28 '24 12:08 hkrutzer

Don't see this issue anymore, memory for the Sender processes has gone down to around 2MB at max 🙂

hkrutzer avatar Dec 03 '24 16:12 hkrutzer

Fantastic, thanks for updating @hkrutzer! 💟

whatyouhide avatar Dec 04 '24 08:12 whatyouhide