Check for deadlocks in telemetry buffers (logs)

未关闭
#2,898 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 2 天内回复

@sl0thentr0py 已经在做这个了。

开始于 2026年3月17日。

评估

这个 Issue 还没有评估数据。

描述

Improvement Logs Ruby Task

Context

The Python SDK hit a deadlock in the logs telemetry buffer (Slack thread). The Ruby SDK has a very similar buffer implementation, so we should audit it for the same class of issue.

Problem (from Python)

  • The logs buffer acquires a lock when adding a log and when flushing/clearing the buffer
  • During a flush (lock held), GC ran and emitted a log → the logging integration tried to add it to the buffer → attempted to acquire the already-held lock → deadlock
  • Re-entrant locks didn't help since the GC callback runs on a different thread

What to check in Ruby

  1. Audit the telemetry buffer lock usage — ensure no code path can trigger a re-entrant lock acquisition (e.g. via callbacks, GC, instrumentation side-effects during flush)
  2. Minimize critical sections — the lock should only protect fetch/pop/clear/add operations on the buffer data structure. Envelope construction and other side-effects should happen outside the lock
  3. Consider the .NET approach — their implementation is mostly lock-free (atomic increments/decrements), only locking briefly during flush to extract a copy of the buffer array before releasing

Related

  • Python fix by Ivana: moved side-effect-producing work outside the locked section
  • Java was checked and looks fine (Alexander)
  • .NET uses lock-free atomics, had a separate recursion issue with Debug=true
主要语言
Ruby
星标
990
派生
552
平均合并
2 天 16 小时
30 天内合并 PR
29

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

getsentry/sentry-ruby 的其他 Issue

查看 getsentry/sentry-ruby 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。