Title: [Bug]: GLib io error if sigint is handled while some icon is loaded · Issue #32556 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: GLib io error if sigint is handled while some icon is loaded · Issue #32556 · matplotlib/matplotlib
X Title: [Bug]: GLib io error if sigint is handled while some icon is loaded · Issue #32556 · matplotlib/matplotlib
Description: Bug summary When handling a sigint while plotting a figure, sometimes a glib error is raised. Sometimes this is handled and execution continues. Code for reproduction import networkx as nx import matplotlib.pyplot as plt import signal im...
Open Graph Description: Bug summary When handling a sigint while plotting a figure, sometimes a glib error is raised. Sometimes this is handled and execution continues. Code for reproduction import networkx as nx import m...
X Description: Bug summary When handling a sigint while plotting a figure, sometimes a glib error is raised. Sometimes this is handled and execution continues. Code for reproduction import networkx as nx import m...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/32556
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: GLib io error if sigint is handled while some icon is loaded","articleBody":"### Bug summary\n\nWhen handling a sigint while plotting a figure, sometimes a glib error is raised. Sometimes this is handled and execution continues.\n\n### Code for reproduction\n\n```Python\nimport networkx as nx\nimport matplotlib.pyplot as plt\nimport signal\nimport io\n\nshould_exit = False\n\ndef handle_sig_int(sig_num, _):\n global should_exit\n should_exit = True\n\ndef draw(G, pos, tree, x, y, d):\n G.add_node(tree[\"key\"])\n pos[tree[\"key\"]] = [x, y]\n if tree[\"left\"] is not None:\n draw(G, pos, tree[\"left\"], x - d, y - 1, d / 2)\n G.add_edge(tree[\"key\"], tree[\"left\"][\"key\"])\n if tree[\"right\"] is not None:\n draw(G, pos, tree[\"right\"], x + d, y - 1, d / 2)\n G.add_edge(tree[\"key\"], tree[\"right\"][\"key\"])\n\ndef draw_tree(buf, tree):\n G = nx.DiGraph()\n\n pos = {}\n draw(G, pos, tree, 0, 0, 1)\n plt.figure(figsize=(3, 3), dpi=300)\n nx.draw(G, pos, \n with_labels=True, \n node_size=500, \n node_color=\"white\", \n edge_color=\"black\", \n font_size=10)\n plt.savefig(buf)\n plt.close()\n\nsignal.signal(signal.SIGINT, handle_sig_int)\ntree = { \"key\": 50,\n \"left\": {\n \"key\": 40,\n \"left\": {\n \"key\": 31,\n \"left\": {\n \"key\": 5,\n \"left\": None,\n \"right\": None\n },\n \"right\": None\n },\n \"right\": None\n },\n \"right\": {\n \"key\": 95,\n \"left\": {\n \"key\": 92,\n \"left\": {\n \"key\": 63,\n \"left\": None,\n \"right\": None\n },\n \"right\": {\n \"key\": 93,\n \"left\": None,\n \"right\": None\n }\n },\n \"right\": None\n }\n }\n\nbuf = io.BytesIO()\nprint(\"setup finished\")\nfor j in range(10):\n n = 100\n for i in range(n):\n draw_tree(buf, tree)\n print(f\"{i}/{n}\", end='\\r')\n print(f\"loop {j} finished\")\n```\n\n### Actual outcome\n\n```\n^CTraceback (most recent call last):\n File \"\u003cfrozen runpy>\", line 203, in _run_module_as_main\n File \"\u003cfrozen runpy>\", line 88, in _run_code\n File \"\u003cpath shortened>/glib-issue-reproduction.py\", line 76, in \u003cmodule>\n draw_tree(buf, tree)\n ~~~~~~~~~^^^^^^^^^^^\n File \"\u003cpath shortened>/glib-issue-reproduction.py\", line 27, in draw_tree\n plt.figure(figsize=(3, 3), dpi=300)\n ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/lib/python3.14/site-packages/matplotlib/pyplot.py\", line 1096, in figure\n manager = new_figure_manager(\n num, figsize=figsize, dpi=dpi,\n facecolor=facecolor, edgecolor=edgecolor, frameon=frameon,\n FigureClass=FigureClass, **kwargs)\n File \"/usr/lib/python3.14/site-packages/matplotlib/pyplot.py\", line 576, in new_figure_manager\n return _get_backend_mod().new_figure_manager(*args, **kwargs)\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^\n File \"/usr/lib/python3.14/site-packages/matplotlib/backend_bases.py\", line 3664, in new_figure_manager\n return cls.new_figure_manager_given_figure(num, fig)\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^\n File \"/usr/lib/python3.14/site-packages/matplotlib/backend_bases.py\", line 3669, in new_figure_manager_given_figure\n return cls.FigureCanvas.new_manager(figure, num)\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^\n File \"/usr/lib/python3.14/site-packages/matplotlib/backend_bases.py\", line 1836, in new_manager\n return cls.manager_class.create_with_canvas(cls, figure, num)\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^\n File \"/usr/lib/python3.14/site-packages/matplotlib/backend_bases.py\", line 2818, in create_with_canvas\n return cls(canvas_class(figure), num)\n File \"/usr/lib/python3.14/site-packages/matplotlib/backends/_backend_gtk.py\", line 147, in __init__\n self.window.set_icon_from_file(\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n str(cbook._get_data_path(f\"images/matplotlib.{icon_ext}\")))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ngi.repository.GLib.GError: gdk-pixbuf-error-quark: Failed to load image “/usr/lib/python3.14/site-packages/matplotlib/mpl-data/images/matplotlib.svg”: Remote error: org.freedesktop.zbus.Error: i/o error (0)\n```\n\n### Expected outcome\n\nNo error, execution continues after the signal is handled.\n\n### Additional information\n\nTo reproduce: Start spamming SIGINT (Ctrl+C) once \"setup finished\" is printed to stdout. Might take some attempts. Some non-fatal error messages appears sometimes.\n\n### Operating system\n\nArch\n\n### Matplotlib Version\n\n3.11.2\n\n### Matplotlib Backend\n\ngtk3agg\n\n### Python version\n\n3.14.8\n\n### Jupyter version\n\nno jupyter in use\n\n### Installation\n\nLinux package manager\n\n[@tacaswell edited to use triple backticks on traceback]","author":{"url":"https://github.com/bonsaiiV","@type":"Person","name":"bonsaiiV"},"datePublished":"2026-10-29T10:10:19Z","url":"https://github.com/matplotlib/matplotlib/issues/32556"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d677a6e2-30c0-5426-d0ab-ed8a5c31d68a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B040:83BF7:10B4787:16142DF:6B064EE6 |
| html-safe-nonce | 61af78d8c0aea19801103ad252ef7c9ee716ab402e5fdfc59b53b5779e6e833a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDQwOjgzQkY3OjEwQjQ3ODc6MTYxNDJERjo2QjA2NEVFNiIsInZpc2l0b3JfaWQiOiI4NjYwMTAzNDM3MzEwMzgxNzk4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5c6e8aac676fea652812369cb8e47499be4829eb23c88c045b8611f0fba45c30 |
| hovercard-subject-tag | issue:6097433236 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/32556/issue_layout |
| twitter:image | https://opengraph.githubassets.com/92ae91e45bfade968be68b850b103c0788d620785d4f5c37129fd451cc521046/matplotlib/matplotlib/issues/32556 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/92ae91e45bfade968be68b850b103c0788d620785d4f5c37129fd451cc521046/matplotlib/matplotlib/issues/32556 |
| og:image:alt | Bug summary When handling a sigint while plotting a figure, sometimes a glib error is raised. Sometimes this is handled and execution continues. Code for reproduction import networkx as nx import m... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bonsaiiV |
| hostname | github.com |
| expected-hostname | github.com |
| None | 772b6997ca4daa0428dd49a25d76052e765555ae560fe9c88517eb828bbd861e |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f1f9a08f7c769a37f1dfc18ad43d463c222a7eea |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width