Legacy singbox protobuf gencode prevents further loading

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

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

評価

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

調査の方向性

C ディスクリプタなしで protobuf-5.28.3 を使用する python:3.13.2-alpine3.21 コンテナでインポート失敗を再現します。traceback にある xtlsapi/init.py、singbox_api/stats_pb2.py、singbox_api/extensions_pb2.py から始めます。その環境で XrayClient のインポートが成功し、singbox API が引き続き利用可能であれば完了です。

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

説明

bug help wanted

Describe the bug
Hi team hiddify,
It's an awesome xtlsapi you created. It works well on windows, but there were issues when I tried to deploy it on docker. I encountered the following problem in python:alpine container, causing the container to fail to start:

>>> from xtlsapi import XrayClient
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    from xtlsapi import XrayClient
  File "/usr/local/lib/python3.13/site-packages/xtlsapi/__init__.py", line 2, in <module>
    from xtlsapi.client.SingboxClient import SingboxClient
  File "/usr/local/lib/python3.13/site-packages/xtlsapi/client/SingboxClient.py", line 3, in <module>
    from xtlsapi.singbox_api_services import APIService
  File "/usr/local/lib/python3.13/site-packages/xtlsapi/singbox_api_services/__init__.py", line 1, in <module>
    from .stats import StatsAPIService
  File "/usr/local/lib/python3.13/site-packages/xtlsapi/singbox_api_services/stats/__init__.py", line 1, in <module>
    from .get_client_upload_traffic import GetClientUploadTraffic
  File "/usr/local/lib/python3.13/site-packages/xtlsapi/singbox_api_services/stats/get_client_upload_traffic.py", line 2, in <module>
    from xtlsapi.singbox_api import stats_pb2
  File "/usr/local/lib/python3.13/site-packages/xtlsapi/singbox_api/stats_pb2.py", line 14, in <module>
    from . import extensions_pb2 as extensions__pb2
  File "/usr/local/lib/python3.13/site-packages/xtlsapi/singbox_api/extensions_pb2.py", line 22, in <module>
    google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension(message_opt)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'MessageOptions' has no attribute 'RegisterExtension'

This seems to be related to https://github.com/mlflow/mlflow/issues/11811. Legacy singbox protobuf gencode prevents further loading when using protobuf without C descriptors, even if not singbox module is imported.

To Reproduce
It's easy to reproduce:

docker run -it python:alpine /bin/sh
pip install xtlsapi
from xtlsapi import XrayClient

Expected behavior
Upgrade singbox protobuf gencode, or lazy import singbox part.

Desktop (please complete the following information):

  • docker image python:3.13.2-alpine3.21
  • OS: Alpine Linux 3.21
  • Python 3.13.2
  • using protobuf without C descriptors, like protobuf-5.28.3-py3-none-any.whl
主要言語
Python
スター
64
フォーク
20
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

hiddify/xtlsapi のほかの issue

hiddify/xtlsapi の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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