AttributeError: 'Response' object has no attribute 'status_code'
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- prometheus, python
- 領域
- backend, observability
調査の方向性
common/gunicorn/logging.py の PrometheusGunicornLogger.access() から始め、gunicorn/workers/base.py のエラーパスを通常のレスポンス処理と比較してください。トレースバックにある不正なヘッダーのパスを再現または調査し、それをログに記録しても AttributeError が発生しなくなり、利用可能なレスポンスステータスが保持されることを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Sentry Issue: FLAGSMITH-API-69B
InvalidHeader: Invalid HTTP Header: 'TRANSFER-ENCODING'
(1 additional frame(s) were not displayed)
...
File "gunicorn/http/parser.py", line 41, in __next__
self.mesg = self.mesg_class(self.cfg, self.unreader, self.source_addr, self.req_count)
File "gunicorn/http/message.py", line 259, in __init__
super().__init__(cfg, unreader, peer_addr)
File "gunicorn/http/message.py", line 62, in __init__
self.set_body_reader()
File "gunicorn/http/message.py", line 461, in set_body_reader
super().set_body_reader()
File "gunicorn/http/message.py", line 186, in set_body_reader
raise InvalidHeader("TRANSFER-ENCODING", req=self)
AttributeError: 'Response' object has no attribute 'status_code'
(3 additional frame(s) were not displayed)
...
File "gunicorn/workers/sync.py", line 69, in run_for_one
self.accept(listener)
File "gunicorn/workers/sync.py", line 31, in accept
self.handle(listener, client, addr)
File "gunicorn/workers/sync.py", line 157, in handle
self.handle_error(req, client, addr, e)
File "gunicorn/workers/base.py", line 278, in handle_error
self.log.access(resp, req, environ, request_time)
File "common/gunicorn/logging.py", line 37, in access
"response_status": resp.status_code,
Exception in worker process
Root cause
When gunicorn rejects a request during parsing, handle_error() builds the Response by hand and sets only resp.status. Our PrometheusGunicornLogger.access() reads resp.status_code, which then raises AttributeError.
Suggested fix
Read the status resiliently on the error path rather than assuming status_code exists — e.g. getattr(resp, "status_code", None), or derive it from resp.status (int(resp.status.split()[0]) when resp.status is a string), mirroring how gunicorn's own logger tolerates responses that never went through start_response().
- 主要言語
- Python
- スター
- 2
- フォーク
- 4
- 平均マージ
- 29分
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Flagsmith/flagsmith-common のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Flagsmith/flagsmith-common#198 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
Flagsmith/flagsmith-common#277 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
Flagsmith/flagsmith-common#254 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
Flagsmith/flagsmith-common#252 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
Flagsmith/flagsmith-common#245 ·
Flagsmith/flagsmith-common の issue をすべて見る
似ている issue
-
fix(ui): serve bundled fonts from the gateway対応中かも @dkritarth が今日担当しました。 オープンagent: in-progress agent: ready P3 type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dkritarth/scopewatch#336 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bob
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
khuisman/mcp-gee-sweet#1267 ·
メンテナーはふだん 1 日以内に返信
-
bug confirmed issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
open-webui/open-webui#33285 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
tv-list
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Gathin23/cleanyourtv#2337 ·
メンテナーはふだん 1 日以内に返信
-
bug P2
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信