bazel-contrib / bazel-contrib/rules_python

bazel_dep rules_python cause Tkinter xcb error

Đã đóng
#1,778 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
need: upstream support type: toolchain
Ngôn ngữ chính
Starlark
Star
688
Fork
721
Merge trung bình
15 giờ 7 phút
Pull request đã merge (30 ngày)
76

Mô tả

# 🐞 bug report

### Affected Rule

The issue is caused by the rule:
`py_binary`

### Is this a regression?

previous rules_python not work, for example 0.28.0

### Description

use `bazel_dep` `rules_python` cause Tkinter xcb error
```
$ bazel run //app:app
INFO: Analyzed target //app:app (75 packages loaded, 2984 targets configured).
INFO: Found 1 target...
Target //app:app up-to-date:
bazel-bin/app/app
INFO: Elapsed time: 0.363s, Critical Path: 0.05s
INFO: 5 processes: 5 internal.
INFO: Build completed successfully, 5 total actions
INFO: Running command line: bazel-bin/app/app
[xcb] Unknown sequence number while appending request
[xcb] You called XInitThreads, this is not your fault
[xcb] Aborting, sorry about that.
python3: ../../src/xcb_io.c:157: append_pending_request: Assertion `!xcb_xlib_unknown_seq_number' failed.
Aborted (core dumped)
```

`MODULE.bazel`
```
bazel_dep(name = "rules_python", version = "0.31.0")
```

`app.py`
```
import ctypes
x11 = ctypes.cdll.LoadLibrary("libX11.so")
x11.XInitThreads()

import tkinter as tk

app = tk.Tk()
button = tk.Button(app, text="Press me")
button.pack()
app.mainloop()

```

## 🔬 Minimal Reproduction

you can clone my repo to reproduce issue
https://github.com/redheli/bazel_issue_reproduce

## 🔥 Exception or Error



[xcb] Unknown sequence number while appending request
[xcb] You called XInitThreads, this is not your fault
[xcb] Aborting, sorry about that.
python3: ../../src/xcb_io.c:157: append_pending_request: Assertion `!xcb_xlib_unknown_seq_number' failed.
Aborted (core dumped)

## 🌍 Your Environment

**Operating System:**

  

$ uname -a
Linux max-ga503rm 5.19.0-40-generic #41~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 31 16:00:14 UTC 2 x86_64 x86_64 x86_64 GNU/Linux


**Output of `bazel version`:**

  

$ bazel --version
bazel 7.0.2

**Rules_python version:**

  

0.31.0

**Anything else relevant?**

workaround is to use `--noenable_bzlmod` , but it is not an option for my project.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với MODULE.bazel và app.py trong bản tái hiện tối thiểu được liên kết, sau đó chạy `bazel run //app:app` với rules_python 0.31.0 và `--noenable_bzlmod` để so sánh. Theo dõi quá trình khởi chạy `py_binary` dưới bazel_dep và xác nhận rằng bản sửa lỗi ngăn chặn lỗi abort XCB của Tkinter, đồng thời vẫn giữ nguyên quá trình khởi động ứng dụng bình thường.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
build-system
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.