LiveKit protocol. Protobuf definitions for LiveKit's signaling protocol https://docs.livekit.io
  • Go 99.7%
  • Shell 0.2%
  • JavaScript 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Erik Hortsch 9aa28a1171
Resolve current stack of stuck lock holders (#1701)
* Resolve current stack of stuck lock holders

The lock tracker records where a stuck lock was first acquired, but not
what its holder is doing now — during an incident the waiters are easy
to find in a goroutine dump while the blocked holder is anonymous.
Record the holder's goroutine id on acquisition (~0.3ns via goid) and
add PopulateHolderStacks to resolve holders' current stacks from a
single runtime.Stack snapshot at scan time.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* avoid empty critical section in test (SA2001)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* track all holder goroutines of stuck locks

Track every holder gid (up to 8 concurrent RWMutex readers) in atomic
slots instead of only the first, so PopulateHolderStacks resolves all
holders' current stacks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* harden holder-slot accounting for cross-goroutine unlock and overflow

Every unlock now removes exactly one holder entry: its own gid if
present, else an overflow credit, else an arbitrary slot (same policy
go-deadlock uses for cross-goroutine unlocks). Replaces the racy
wipe-all-slots-at-zero, making occupied slots + overflow == holders an
exact invariant.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* split single-holder tracking from the RW reader extension

Mutex has exactly one holder and trackLock/trackUnlock run while it is
held, so its bookkeeping needs no atomics — a plain gid store replaces
the slot claim, and cross-goroutine unlock just clears it. The slot
array, overflow accounting, and eviction heuristics now exist only for
RWMutex readers in lock_tracker_rw.go, where holders are genuinely
concurrent. Wrapped Mutex Lock/Unlock: 8.7ns -> 6.1ns (pre-tracking
baseline 6.2ns, native 4.0ns).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* hoist tracker nil checks to call sites and report holder strength

Lock paths guard tracking behind one nil check with the post-acquire
bookkeeping deferred; unlock paths use a bare atomic load (loadTracker)
instead of the full lazy-init, since a lock being unlocked was locked
first. StuckLock gains HolderStrength (exclusive vs shared readers).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* extract window helper for incremental scans

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* single tracker registry with side-effect-free construction

lazyInitTracker now CASes the constructed tracker directly: construct
is pure allocation, the CAS winner registers, losers are left to the
GC. This removes the mid-init sentinel state, the runtime spin
linknames, and the per-type registration/finalizer duplication. Both
tracker types live in one registry — rwLockTracker extends lockTracker,
so the scan reads the base through every ref and toStuckLock gathers
reader slots when the rw flag is set. window is a weakRefList method
with the cursor as a field.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* review hardening: typed atomics, sized STW buffer, gid dedupe

Typed atomics on the reader fields guarantee 64-bit alignment on 32-bit
platforms regardless of struct layout. PopulateHolderStacks sizes its
buffer from the live goroutine count so the stop-the-world snapshot is
one pass on goroutine-heavy processes. toStuckLock dedupes reader gids
so a recursive RLock doesn't resolve the same holder stack twice. Drop
stale comment reference.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* generated protobuf

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-12 10:38:53 -07:00
.changeset Resolve current stack of stuck lock holders (#1701) 2026-08-12 10:38:53 -07:00
.github/workflows Update github workflows (#1655) 2026-08-02 00:07:39 -07:00
.idea agents protocol proposal (#595) 2024-04-03 22:49:52 +02:00
agent rename agent environment to deployment (#1532) 2026-05-05 14:14:10 -07:00
auth fix(auth): require exp claim when verifying access tokens (#1706) 2026-08-10 12:03:35 +08:00
codecs Remove H.264 baseline (42001f) from default enabled codecs (#1698) 2026-08-04 08:16:16 +08:00
connector fix(connector): update error codes, add new error type (#1455) 2026-03-17 02:21:28 +05:30
egress StartEgress v2 (#1596) 2026-06-01 19:27:23 -04:00
infra Use CreateIngress with return value instead of CreateIngress2 (#1708) 2026-08-11 10:29:48 +08:00
ingress fix go ci (#1473) 2026-04-02 01:57:36 -07:00
livekit Use CreateIngress with return value instead of CreateIngress2 (#1708) 2026-08-11 10:29:48 +08:00
logger Cap RPC payload logging with size-limited proto summaries (#1668) 2026-07-15 16:43:24 +02:00
mimetype move mime to new pkg (#1374) 2026-01-20 20:12:10 +05:30
observability generated: add realtime reporter methods to gatewayobs (#1663) 2026-07-29 16:55:46 -04:00
packages/javascript update deps (#1693) 2026-08-02 00:10:56 -07:00
pprof Add license headers & NOTICE (#429) 2023-07-27 16:43:25 -07:00
protobufs Use CreateIngress with return value instead of CreateIngress2 (#1708) 2026-08-11 10:29:48 +08:00
psrpc refactor suppress errors (#1016) 2025-03-20 21:35:17 -07:00
redis deps: migrate jwt/xsync/errors libraries + add jwtutil helper (#1606) 2026-06-05 14:20:20 -07:00
rpc Use CreateIngress with return value instead of CreateIngress2 (#1708) 2026-08-11 10:29:48 +08:00
sdp feat(connectors): initial impl (#1221) 2025-10-13 16:00:54 +05:30
signalling Include mid -> trackID in SDP. (#1256) 2025-10-15 23:01:18 +05:30
sip Revert "Add RoomAdmin to SIPTokenParams (#1677)" (#1707) 2026-08-08 22:42:26 +08:00
tools Add license headers & NOTICE (#429) 2023-07-27 16:43:25 -07:00
tracer Add helper for setting Jaeger tracing. (#1355) 2026-01-06 13:23:17 +02:00
utils Resolve current stack of stuck lock holders (#1701) 2026-08-12 10:38:53 -07:00
webhook feat(webhooks): configurable UA and delivery status code (#1692) 2026-08-01 14:47:45 +05:30
xtls update yaml config tags (#741) 2024-06-13 23:08:01 -07:00
.gitattributes update observability codegen (#1335) 2025-12-15 11:50:58 -08:00
.gitignore Separate protobufs and set up changesets publishing workflow (#629) 2024-03-08 10:37:35 +01:00
.golangci.yml add local protojson with permissive defaults (#1542) 2026-05-06 22:34:34 -07:00
bootstrap.sh [S3 Upload] Add content disposition field (#525) 2023-11-27 13:48:43 -08:00
CHANGELOG.md Version Packages (#1680) 2026-07-21 18:37:26 +01:00
go.mod Resolve current stack of stuck lock holders (#1701) 2026-08-12 10:38:53 -07:00
go.sum Resolve current stack of stuck lock holders (#1701) 2026-08-12 10:38:53 -07:00
LICENSE Switching to Apache-2.0 license to be consistent with rest of repos (#205) 2022-09-16 19:08:15 -07:00
magefile.go agentdb: protocol for per-agent session storage (#1686) 2026-08-05 16:41:20 -07:00
NOTICE Add license headers & NOTICE (#429) 2023-07-27 16:43:25 -07:00
package.json update deps (#1693) 2026-08-02 00:10:56 -07:00
pnpm-lock.yaml update deps (#1693) 2026-08-02 00:10:56 -07:00
pnpm-workspace.yaml Update dependency @babel/core to v7.29.6 [SECURITY] (#1631) 2026-06-19 22:31:13 -07:00
renovate.json chore: renovate 7 day waiting period (#1497) 2026-04-11 12:25:26 -07:00