getsentry / sentry-elixir

The official Elixir SDK for Sentry (sentry.io)
https://sentry.io
MIT License
622 stars 183 forks source link

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

Open hkrutzer opened 4 weeks ago

hkrutzer commented 4 weeks ago

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.

whatyouhide commented 4 weeks ago

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

whatyouhide commented 2 weeks ago

@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.

hkrutzer commented 2 weeks ago

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).