[Bug]: macosx backend crashes when used on a worker thread
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
先使用 macosx backend 執行提供的 Python 重現程式,並比較列出的 worker-thread 方法。追蹤涉及的 macosx backend 入口點,接著讓已同意的背景執行緒呼叫引發 Python 錯誤,而不是造成當機,同時確認對 Timer 和 FigureCanvas.draw_idle() 的處理。
由索引模型根據 Issue 內容生成。
描述
Bug summary
While Interactive figures and asynchronous programming specifically states that "In general Matplotlib is not thread safe", the macosx backend crashes with SIGSEGV or SIGTRAP when various methods are called on a worker thread:
| Method | Result |
|---|---|
| FigureCanvas.flush_events | CRASH |
| FigureManager.set_window_title | Obj-C Exception |
| FigureManager.show | CRASH |
| FigureManager.resize | CRASH |
| FigureManager.full_screen_toggle | CRASH |
Some methods, like FigureCanvas.set_cursor, do work without crashing; however, NSCursor isn't documented to be thread-safe. It's also not on the historic list of thread-unsafe classes, so our usage falls into a gray area.
I think we should default to setting a Python error when any macosx backend method is called on a background thread, with specific exceptions for Timer or FigureCanvas.draw_idle(). Possibly others?
Code for reproduction
import threading
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use("macosx")
fig = plt.figure()
canvas = fig.canvas
manager = fig.canvas.manager
def worker():
canvas.flush_events() # EXC_BAD_ACCESS (SIGSEGV)
# manager.show()
# manager.resize(100, 200)
t = threading.Thread(target=worker)
t.start()
t.join()
Actual outcome
SIGSEGV, SIGTRAP, Obj-C Exception
Expected outcome
A Python error is thrown.
Additional information
No response
Operating system
No response
Matplotlib Version
3.11
Matplotlib Backend
macosx
Python version
3.14.5
Jupyter version
No response
Installation
None
- 主要語言
- Python
- 星號
- 23.6k
- 分支
- 8.6k
- 平均合併
- 1 天 19 小時
- 30 天內合併 PR
- 64
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
matplotlib/matplotlib 的其他 Issue
-
[Bug]: Saving a NonUniformImage with bbox_inches="tight" raises TypeError when extent is omitted可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 74/100
matplotlib/matplotlib#32707 ·
維護者通常 1 天內回覆
-
[Bug]: withTickedStroke raises ValueError when the line contains NaN可能已有人在做 @RjyavardhanSingh 於 4 天前認領。 未關閉first-contribution topic: path handling
難度 2/5 1-3 小時 新手友好度 85/100
matplotlib/matplotlib#32689 · 2 則留言 ·
維護者通常 1 天內回覆
-
[Bug]: Constrained layout raises ZeroDivisionError when the first height/width ratio is zero可能已有人在做 @yqtian-se 於 1 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 85/100
matplotlib/matplotlib#32684 · 3 則留言 ·
維護者通常 1 天內回覆
-
[Bug]: twin axes ignore the navigation opt-outs可能已有人在做 @NaumanRafay 於 37 天前認領。 未關閉topic: toolbar
難度 2/5 1-3 小時 新手友好度 78/100
matplotlib/matplotlib#32528 · 2 則留言 ·
維護者通常 1 天內回覆
-
[Bug]: macOS font discovery raises KeyError('_items') for an incomplete system_profiler font record未關閉first-contribution OS: Apple status: needs clarification topic: text/fonts
難度 2/5 1-3 小時 新手友好度 84/100
matplotlib/matplotlib#32328 · 4 則留言 ·
維護者通常 1 天內回覆
查看 matplotlib/matplotlib 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
plone/plone.observability#114 ·
維護者通常 1 天內回覆
-
area:docs type:docs
難度 2/5 1-3 小時 新手友好度 68/100
jejjohnson/gauss_flows#246 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
netbox status: needs triage type: feature
難度 2/5 1-3 小時 新手友好度 68/100
netbox-community/netbox#23868 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
emeryberger/CSrankings#15757 ·
維護者通常 9 天內回覆