Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Segfault when two threads create AudioResampler at once (recorder + Google realtime)

オープン
#7,432 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python

調査の方向性

Start by reading livekit/rtc/_ffi_client.py around line 295 and livekit/rtc/audio_resampler.py around line 71, where both thread stacks enter the FFI request during resampler creation. Reproduce with recorder audio enabled so the recorder encode thread and Google realtime input path create resamplers concurrently. Done means concurrent creation no longer causes the reported segfault.

索引モデルが issue の本文から書いたものです。

説明

A realtime agent sometimes crashes with a segfault right as the session starts, when two threads create an rtc.AudioResampler at the same moment. It happened in 3 of 10 local runs for us.

The two threads are Google realtime's input path on the main thread and the session recorder's encode thread:

Current thread (most recent call first):
  livekit/rtc/_ffi_client.py, line 295 in request
  livekit/rtc/audio_resampler.py, line 71 in __init__
  livekit/plugins/google/realtime/realtime_api.py, line 1668 in _resample_audio
  livekit/plugins/google/realtime/realtime_api.py, line 792 in push_audio
  livekit/agents/voice/agent_activity.py, line 1680 in push_audio

Thread (recorder_io encode thread):
  livekit/rtc/_ffi_client.py, line 295 in request
  livekit/rtc/audio_resampler.py, line 71 in __init__
  livekit/agents/voice/recorder_io/recorder_io.py, line 88 in _resample
  livekit/agents/voice/recorder_io/recorder_io.py, line 105 in push
  livekit/agents/voice/recorder_io/recorder_io.py, line 299 in _encode_thread

Fatal Python error: Segmentation fault

Versions: livekit 1.1.18, livekit-agents 1.8.2, livekit-plugins-google 1.8.2, Python 3.12.14, macOS arm64.

Starting the session with record={"audio": False} avoids it, since no recorder thread is created. Is livekit_ffi_request meant to be safe when resamplers are created from two threads at once?

主要言語
Python
スター
14.6k
フォーク
3.9k
平均マージ
2日 17時間
マージ済み PR(30日)
207

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

livekit/agents のほかの issue

livekit/agents の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。