After upgrading to newer versions of appstream (0.9.7-1 and now 0.9.8-1 on ubuntu 16.10), I am getting consistent crashes when calling find_components consecutively from python3. This script dumps for me every time:
#!/usr/bin/env python
import gi
gi.require_version('AppStream', '1.0')
from gi.repository import AppStream
db = AppStream.Database()
db.open()
db.find_components("gedit", None) # Fine, continue...
db.find_components("gedit", None) # Crash!
Am I using this incorrectly? I've tried running appstreamcli refresh --force --verbose and seen nothing interesting. I've reproduced this exact issue on another machine. I tested on a machine with ubuntu 16.04 and found that version 0.9.4-1ubuntu1 still works as expected.
The text was updated successfully, but these errors were encountered:
This is a really weird issue... Apparently, the token_cache hash table is dead. This can only happen though, if the AsComponent which owns it is also dead.
And that should never happen, unless Python manually kills the objects inside the result array, which it shouldn't do (the result array is marked as transfer full, which means that the array itself should be freed, not its contents).
Oh crap! Apparently Python3 treats a GPtrArray as a full-blown container type, meaning that it will free its contents... So, the annotation there is wrong, it should only mark the container as transferred.
#!/usr/bin/env python3importgigi.require_version('AppStream', '1.0')
fromgi.repositoryimportAppStreampool=AppStream.Pool()
pool.load()
pool.search("gedit")
res=pool.search("gedit") # No more crashes!forcptinres:
print(cpt.get_id())
I will probably backport this patch to the AppStream version in Debian Unstable / Ubuntu Yakkety, but both should ship with AppStream 0.10 or higher anyway :)
Thank you for reporting this issue!
(and I wonder whether it would be possible to have a testsuite for Python stuff as well)
After upgrading to newer versions of appstream (0.9.7-1 and now 0.9.8-1 on ubuntu 16.10), I am getting consistent crashes when calling find_components consecutively from python3. This script dumps for me every time:
The results:
Am I using this incorrectly? I've tried running
appstreamcli refresh --force --verboseand seen nothing interesting. I've reproduced this exact issue on another machine. I tested on a machine with ubuntu 16.04 and found that version0.9.4-1ubuntu1still works as expected.The text was updated successfully, but these errors were encountered: