Segfault in soup_message_headersiter_next when running request.get_http_headers in a webkit extension
Submitted by msdemlei
First off, apologies for this somewhat lousy bug report -- I'm a bit discouraged by the apparent complexity of the python webkit/gi wrapping and, on the other hand, hope that the problem may be obvious if one understands that system.
I'm trying to write a python extension to webkit using aperez' extension wrapper (https://github.com/aperezdc/webkit2gtk-python-webextension-example/; I hope that's not relevant, though). In the extension, I'm doing, essentially, in a page-created handler:
Then the code:
def on_send_request(self, web_page, request, redirect): request.get_http_headers()
(yes, just obtaining the http header object is enough even if it is immediately discarded) causes a segfault in the rendering process; diagnostics like this is logged:
WebKitWebProces: segfault at 4 ip 00000000f223dfef sp 00000000ff901d44 error 4 in libsoup-2.4.so.1.8.0[f21f6000+bb000]
When examining a core dumped, like this:
gdb /usr/lib/i386-linux-gnu/webkit2gtk-4.0/WebKitWebProcess core
with the debug symbols for libsoup (but not webkitgtk until someone tells me it's actually useful), the traceback looks like this:
This is for gir1.2-soup-2.4 and libsoup2.4 as in Debian stretch (2.56.0-2), all called from python3.
So, I'm hoping it's just a forgotten or skipped INCREF at a strategic location in the wrapper -- but when I tried to look for it, I quickly got lost in gi and gtk and glib and their interactions.
So -- any chance someone with sufficient insight could have a look? Or is there some overview over how all the gears work together and what I can do to make diagnosis a bit easier?