Sentry.Sources keeps the decoded source-code map on its heap after loading it into ETS
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc Sentry.Sources.handle_continue/2, đặc biệt là nhánh :load_source_code_map, nơi giải mã bản đồ được đóng gói và chèn các mục vào ETS. Kiểm tra các bài kiểm thử callback của GenServer và xác minh rằng tiến trình giải phóng bản đồ đã giải mã sau khi tải, trong khi các mục ETS vẫn có thể được truy cập. Issue không nêu tên tệp kiểm thử, vì vậy hãy tìm các bài kiểm thử liên quan trong repository.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
- sentry 13.4.2, Elixir 1.20.4 / OTP 29.1.1,
enable_source_code_context: true - Release with a packaged source-code map (
mix sentry.package_source_code)
What happens
Sentry.Sources.handle_continue(:load_source_code_map, state) decodes the whole map (:erlang.binary_to_term/1 on the packaged file), inserts each entry into the :sentry_source_code_map ETS table and returns {:noreply, state}. The process then receives no further messages, so it never triggers a garbage collection. The decoded term, which ETS has already copied, stays on the process heap for the life of the node.
On a ~6,400-module app this was about 57 MB per node, on top of the ~54 MB the ETS table needs:
pid = Process.whereis(Sentry.Sources)
Process.info(pid, :total_heap_size) # ~7.1M words ≈ 57 MB
:erlang.garbage_collect(pid)
Process.info(pid, :total_heap_size) # near zero
This matters on small machines: on a 1 GB container, this one process held ~6% of RAM for nothing.
Suggested fix
Shrink the heap once the load is done, for example:
{:noreply, state, :hibernate}
or an explicit :erlang.garbage_collect() before returning from handle_continue/2. :hibernate is enough because the process is idle afterwards. Decoding the map outside the GenServer (in a short-lived task) would also avoid it.
Workaround
After the application starts, we wait for the load to finish with :sys.get_state(Sentry.Sources) and then call :erlang.garbage_collect/1 on the process.
- Ngôn ngữ chính
- Elixir
- Star
- 692
- Fork
- 219
- Merge trung bình
- 2 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/sentry-elixir
-
Add a prebuilt Elixir runtime metrics dashboardCó thể đã có người làm @sl0thentr0py đã nhận 10 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
getsentry/sentry-elixir#1233 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 10/100
getsentry/sentry-elixir#1232 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
traces_sampler example doesn't match the actual context providedCó thể làm lại được @solnic đã nhận 351 ngày trước và không có pull request nào đang mở. Đang mởBug Elixir Traces Waiting for: Product Owner
getsentry/sentry-elixir#945 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Better oban error groupingCó thể làm lại được @solnic đã nhận 452 ngày trước và không có pull request nào đang mở. Đang mởElixir Errors Improvement
getsentry/sentry-elixir#936 · 1 bình luận · 2 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Custom fingerprint added to GenServer call crashes by clientCó thể làm lại được @solnic đã nhận 459 ngày trước và không có pull request nào đang mở. Đang mởBug Elixir Errors
getsentry/sentry-elixir#933 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của getsentry/sentry-elixir
Issue tương tự
-
[Bug]: PostgreSQL backend: Queue.remove() / Job.remove() never emit the QueueEvents "removed" eventCó thể đã có người làm @1AbdullahButt đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
taskforcesh/bullmq#5085 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Step-by-step Ash GuideĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
liveshowy/webauthn_components#118 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
intellij-elixir/intellij-elixir#4645 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
ash-project/ash_typescript#114 ·