[🐛 Bug]: [py] A BiDi event payload nested too deeply closes the WebSocket connection
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 85/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- backend, networking
調査の方向性
py/selenium/webdriver/common/_bidi/dispatcher.pyを読み、EventDispatcher.receiveとBiDiSerializationErrorの処理に注目してください。提供された深くネストされたscript.messageペイロードで障害を再現し、RecursionErrorがログに記録され、接続を閉じることなくイベントが破棄されることを確認してください。セッション上の後続のコマンドとイベントが引き続き動作すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
A BiDi event whose payload is nested too deeply for Record.from_json to read closes the WebSocket connection instead of being dropped, so every later command and event on that session fails.
EventDispatcher.receive (py/selenium/webdriver/common/_bidi/dispatcher.py) deserializes each event on the socket's reader thread and only catches BiDiSerializationError. from_json reads nested typed values recursively (a script array value costs several frames per level), so a value nested about 190 levels deep raises RecursionError. That escapes to websocket-client's on_error, and WebSocketConnection._start_ws closes the socket there. json.loads accepts the same payload, since it handles about 990 nested JSON levels.
Command results are read on the caller's thread, so there the RecursionError reaches the caller and the connection stays open.
Suggested fix: have EventDispatcher.receive also catch RecursionError and log and drop the payload, as it already does for one that fails validation.
Reproducible Code
from selenium.webdriver.common._bidi.script import MessageParameters
value = {"type": "undefined"}
for _ in range(250):
value = {"type": "array", "value": [value]}
# The params of a script.message event; raises RecursionError (Python 3.10, default recursion limit)
MessageParameters.from_json({"channel": "c", "data": value, "source": {"realm": "r"}})
With a listener added through Script(...).add_message_listener(...), the same params arriving as a script.message event close the connection.
- 主要言語
- Java
- スター
- 34.6k
- フォーク
- 8.7k
- 平均マージ
- 1日 16時間
- マージ済み PR(30日)
- 107
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SeleniumHQ/selenium のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
SeleniumHQ/selenium#18323 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
B-build C-py I-enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
SeleniumHQ/selenium#18435 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[🐛 Bug]: Bindings change the user's options when Selenium Manager supplies a browser対応中かも @Liz-Lian が 2 日前に担当しました。 オープンC-dotnet C-java C-nodejs C-py C-rb I-defect
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
SeleniumHQ/selenium#18428 ·
メンテナーはふだん 1 日以内に返信
-
[🐛 Bug]: [rust] Selenium Manager can return a browser from the cache before it finishes copying対応中かも @Liz-Lian が 2 日前に担当しました。 オープンC-rust I-defect
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
SeleniumHQ/selenium#18427 ·
メンテナーはふだん 1 日以内に返信
-
C-py D-chrome OS-windows
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
SeleniumHQ/selenium#18394 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
SeleniumHQ/selenium の issue をすべて見る
似ている issue
-
area-integrations
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
isXander/YetAnotherConfigLib#376 ·
-
? - Needs Triage bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NVIDIA/cudf-spark-jni#5598 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
oracle/graalvm-reachability-metadata#12264 ·
メンテナーはふだん 1 日以内に返信
-
[source-facebook-pages] post stream never returns attachments.media_type対応中かも @v-k-data が今日担当しました。 オープンarea/connectors needs-triage type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信