Created attachment 1900382 [details] Example program demonstrating issue with Gtk3 Description of problem: Some Python Gtk3 & Gtk4 applications crash after a while with memory errors on Fedora 36. The same applications worked in prior Fedora versions, the crashes started after an upgrade to Fedora 36. The affects more than one home-grown Python Gtk3 application. All of them exhibit the same behavior. I have tested on different hardware to rule out a hardware problem. Version-Release number of selected component (if applicable): - Linux 5.17.9-300.fc36.x86_64 #1 SMP PREEMPT Wed May 18 15:08:23 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux - Fedora release 36 (Thirty-Six) - python3-3.10.5-2.fc36.x86_64 - gtk3-3.24.34-1.fc36.x86_64 - gtk4-4.6.6-1.fc36.x86_64 - gobject-introspection-1.72.0-1.fc36.x86_64 - python3-gobject-base-3.42.1-1.fc36.x86_64 How reproducible: A minimal Python program that exhibits this problem is attached Steps to Reproduce: 1. Run the application 2. Wait a few hours at most Actual results: After a few hours (time varies) you get multiple messages of the form: ... ** (gtk3bug.py:3785297): WARNING **: 20:50:00.762: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.762: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.762: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.763: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.861: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.861: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.861: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.862: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.862: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.862: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.862: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.862: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.863: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.863: could not allocate closure ** (gtk3bug.py:3785297): WARNING **: 20:50:00.961: could not allocate closure ... ***MEMORY-ERROR***: gtk3bug.py[3785297]: GSlice: failed to allocate 1008 bytes (alignment: 1024): Cannot allocate memory Expected results: The application should be able to stay running indefinitely. Additional info: The attached code resulted from trying to identify the faulty component by stripping down features. Secondly, I have tested both Gtk3 and Gtk4 and the problem is exactly the same suggesting it may be due to a different system library rather than Gtk.
After some investigation, I found that this is a bug in pygobject caused by an API change in libffi. GObject-introspection was updated to the new API and backward-compatible functions were provided to replace the outgoing API. However, one of the functions that was supposed to free the memory created for the closure, does nothing, leaking memory. I have submitted a merge-request to the master branch of the upstream pygobject that fixes this problem. I also have a patch for the released version of python3-gobject-3.42.1 in Fedora 36.
Created attachment 1921261 [details] Patch for python3-gobject-3.42.1
Created attachment 1921262 [details] Example python program demonstrating issue I've modified the test program so that it fails more quickly. The previous test code failed after 4 hours, this version fails after ~10 minutes. With the above patch applied, I have an instance running for almost a week now and counting, without failing.
This message is a reminder that Fedora Linux 36 is nearing its end of life. Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a 'version' of '36'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, change the 'version' to a later Fedora Linux version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see it. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora Linux 36 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora Linux, you are encouraged to change the 'version' to a later version prior to this bug being closed.
Fedora Linux 36 entered end-of-life (EOL) status on 2023-05-16. Fedora Linux 36 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora Linux please feel free to reopen this bug against that version. Note that the version field may be hidden. Click the "Show advanced fields" button if you do not see the version field. If you are unable to reopen this bug, please file a new report against an active release. Thank you for reporting this bug and we are sorry it could not be fixed.