LocalParticipant awaits track.processor?.onPublish() unbounded inside the publish lock — any slow processor freezes publish/mute for the rest of the session
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 38/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 领域
- mobile-dev
调研方向
Read lib/src/participant/local.dart at the audio and video onPublish call sites, along with lib/src/support/serial_runner.dart to understand the publish lock. Then inspect the E2EContainer harness used in #1152 and determine whether onPublish must complete before track.start() or the publish future resolves. Done means a regression test with a never-resolving processor verifies that publishing returns and a subsequent mute completes.
由索引模型根据 Issue 内容生成。
描述
Follow-up to #1151 / #1152, filed at @hiroshihorie's request in the approval review on #1152.
Summary
_publishAudioTrack runs entirely inside _publishRunner (the SerialRunner that serializes all publish/unpublish/mute/enable operations), and after the track is already fully published it does an unbounded await on third-party processor code:
- processor await (audio): https://github.com/livekit/client-sdk-flutter/blob/9e05b7987f26de415750b3c12d0e4c889a64f920/lib/src/participant/local.dart#L239-L240
- same pattern (video): https://github.com/livekit/client-sdk-flutter/blob/9e05b7987f26de415750b3c12d0e4c889a64f920/lib/src/participant/local.dart#L519-L520
- the lock: https://github.com/livekit/client-sdk-flutter/blob/9e05b7987f26de415750b3c12d0e4c889a64f920/lib/src/participant/local.dart#L68 with https://github.com/livekit/client-sdk-flutter/blob/9e05b7987f26de415750b3c12d0e4c889a64f920/lib/src/support/serial_runner.dart#L38-L40
TrackProcessor.onPublish is an open extension point, so the SDK is awaiting arbitrary user/plugin code — in livekit_noise_filter's case, a server round-trip — inside its most contended critical section. If that future is slow or never resolves:
- The track is already published and live (
addTrackPublicationhas run, audio/video flows to remote participants). - The
setMicrophoneEnabled(true)/publish*Trackfuture doesn't resolve. - The held
SerialRunnerblocks every subsequentsetMicrophoneEnabled/setCameraEnabled/setSourceEnabled/ unpublish — the user cannot mute a live microphone for the rest of the session.
#1151 was one concrete trigger (the getSid() deadlock, now fixed); this issue is about the amplifier that turned it from "one hung future" into "an unmutable live mic". Any future slow onPublish reproduces the same failure.
Proposal
Detach the processor handoff from the publish critical section: the track is already fully published when onPublish runs, so treat it as asynchronous decoration — run track.processor?.onPublish(room) unawaited with errors logged (or await it after the runner block returns), instead of holding the lock on it. ~10-line diff at the two call sites, plus a regression test (fake processor whose onPublish never resolves; assert publish returns and a subsequent mute completes — same E2EContainer harness as #1152).
Alternative, if completion-before-return must be preserved: bound the await with a timeout + logged warning. Weaker — it converts "forever" into "N seconds of unmutable mic" and picks an arbitrary constant.
One semantics question I'd like your call on before opening the PR: is anything expected to rely on onPublish completing before track.start() / before the publish future resolves? If yes, the timeout variant (or detach-after-start()) is the shape.
Complementary (separate repo, happy to file there too): livekit_noise_filter.onPublish blocks on await room.getSid() just to build its context map — it could send the context immediately and update the sid when it resolves, making the plugin robust on old SDK versions as well.
I'm glad to open the PR for whichever direction you prefer.
- 主要语言
- Dart
- 星标
- 421
- 派生
- 260
- 平均合并
- 3 天 9 小时
- 30 天内合并 PR
- 11
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
livekit/client-sdk-flutter 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
livekit/client-sdk-flutter#1227 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
livekit/client-sdk-flutter#1221 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 30/100
livekit/client-sdk-flutter#1219 · 1 个 reaction ·
维护者通常 1 天内回复
-
iOS: `audioDeviceModule` becomes permanently `nil`/unavailable after backgrounding, even though `AVAudioSession` is never interrupted可能已有人在做 @hiroshihorie 于 31 天前认领。 未关闭
livekit/client-sdk-flutter#1206 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[bug]Early reconnect during the initial room connection可能重新可做 @hiroshihorie 于 42 天前认领,目前没有进行中的 PR。 未关闭
livekit/client-sdk-flutter#1189 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 livekit/client-sdk-flutter 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
AimesSoft/NipaPlay-Reload#1021 ·
维护者通常 1 天内回复
-
enhancement triage
难度 2/5 1-3 小时 新手友好度 62/100
fluttercommunity/plus_plugins#4004 ·
维护者通常 1 天内回复
-
agent:ready bug P2 · 中 健壮性 区域: 启动与合规 待验证 隐私与合规
难度 2/5 1-3 小时 新手友好度 66/100
ASDW51/DanmuFloat#106 ·
维护者通常 1 天内回复
-
c: proposal p: go_router package team-ecosystem
难度 2/5 1-3 小时 新手友好度 60/100
flutter/flutter#194542 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement good first issue help wanted
难度 2/5 1-3 小时 新手友好度 80/100