After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 743296 - segfault in json.so when launching GIMP
segfault in json.so when launching GIMP
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: general
git master
Other Linux
: Normal major
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2015-01-21 13:55 UTC by BugsBunny
Modified: 2015-01-25 14:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
stack backtrace (8.49 KB, text/plain)
2015-01-21 13:56 UTC, BugsBunny
Details
backtrace for simple gegl code (2.94 KB, text/plain)
2015-01-21 23:14 UTC, Thomas Manni
Details

Description BugsBunny 2015-01-21 13:55:12 UTC
Hello

Today's GEGL from git has a bug which results in GIMP segfaulting on start.

x86_64 Intel(R) Core(TM) i7 CPU Q 820

CFLAGS="-march=native -O2 -pipe -ggdb" FEATURES="nostrip" emerge dev-libs/json-glib dev-libs/glib media-libs/gegl media-libs/babl media-gfx/gimp

Stack backtrace attached.
Comment 1 BugsBunny 2015-01-21 13:56:48 UTC
Created attachment 295101 [details]
stack backtrace
Comment 2 BugsBunny 2015-01-21 22:02:18 UTC
Bumping 'importance' to 'major' as this completely breaks GIMP.
Comment 3 Thomas Manni 2015-01-21 23:14:19 UTC
Created attachment 295137 [details]
backtrace for simple gegl code
Comment 4 Thomas Manni 2015-01-21 23:16:24 UTC
This is the code of the previous attached backtrace:

#include <gegl.h>

gint
main (gint argc, gchar **argv)
{
  GeglNode *gegl;
  GeglNode *checkerboard;
  
  g_object_set (gegl_config (), "application-license", "GPL3", NULL);

  gegl_init (&argc, &argv);

  gegl = gegl_node_new ();

  checkerboard = gegl_node_new_child (gegl, "operation", "gegl:checkerboard",
                                      NULL);
  
  g_object_unref (gegl);

  gegl_exit ();

  return 0;
}
Comment 5 BugsBunny 2015-01-22 11:43:10 UTC
Workaround to get GIMP running is to remove /usr/lib64/gegl-0.3/grey2.json
Comment 6 Jon Nordby 2015-01-24 03:40:10 UTC
Can you guys share your versions of json-glib and glib? And any special things around the environment and/or install procedure?

I've not been able to reproduce this reliably on my machine. Though I seem to have tests failing 1/4 times with similar symptoms on Travis CI (each run potentially has a different machine).
Comment 7 BugsBunny 2015-01-24 12:16:17 UTC
Standard Gentoo installation procedure.

dev-libs/glib-2.40.2
dev-libs/json-glib-1.0.2

I deleted /usr/lib64/gegl-0.3/grey2.json to get it working so I can't upload it - I should have done that first. I see there is a new file there under that name  but GIMP starts fine now, so no point uploading this one.

emerge --info
Portage 2.2.14 (python 2.7.9-final-0, default/linux/amd64/13.0/desktop/kde, gcc-4.8.3, glibc-2.19-r1, 3.18.3-gentoo-nouveau-m x86_64)
=================================================================
System uname: Linux-3.18.3-gentoo-nouveau-m-x86_64-Intel-R-_Core-TM-_i7_CPU_Q_820_@_1.73GHz-with-gentoo-2.2
KiB Mem:     8164272 total,   4375052 free
KiB Swap:    8383484 total,   8381564 free
Timestamp of tree: Thu, 22 Jan 2015 11:45:01 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
ccache version 3.1.9 [disabled]
app-shells/bash:          4.2_p53
dev-java/java-config:     2.2.0
dev-lang/perl:            5.18.2-r2
dev-lang/python:          2.7.9-r1, 3.3.5-r1, 3.4.1
dev-util/ccache:          3.1.9-r4
dev-util/cmake:           3.0.2
dev-util/pkgconfig:       0.28-r1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.13.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.69
sys-devel/automake:       1.10.3, 1.11.6-r1, 1.13.4
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.8.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.4
sys-devel/make:           4.0-r1
sys-kernel/linux-headers: 3.16 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo x-portage dr spring
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirror.mdfnet.se/gentoo http://trumpetti.atm.tut.fi/gentoo/ http://mirror.leaseweb.com/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /var/lib/layman/dr /var/lib/layman/Spring"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 apache2 bash-completion berkdb bluetooth branding bs2b bzip2 cairo cdda cdr cli clucene consolekit cracklib crypt cue cups curl custom-optimization cxx d3d dbus declarative desktop dhclient dirac dri dts dvd dvdr emboss enca encode exif expoblending fam fat fdk ffmpeg firefox flac fontconfig fortran frei0r ftp fuse g3dvl gallium gd gdbm geoip gif glamor gpm gpu gsm hbci iconv icu iproute2 iptc ipv6 jabber java jpeg jpeg2k kde kdenlive kipi lcms ldap lensfun libkms libnotify mad melt minizip mjpeg mmx mng modules mp3 mp4 mpeg mpi msn multilib multithreaded mysql ncurses network networkmanager nls nptl nsplugin nvidia ofx ogg okteta opencl openexr opengl openmp openvpn otr pam pango pcre pdf phonon php plasma png policykit postproc ppds privacy pulseaudio python qt3support qt4 rar rasterr readline romio scanner schroedinger sdl semantic-desktop session sid sip smbclient smp sms spell sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssse3 startup-notification svg tcpd theora threads tiff tordns truetype udev udisks unicode upower usb uvm v4l v4l2 vdpau vnc vorbis vpx wav webkit webpresence wifi wxwidgets x264 xattr xcb xcomposite xinerama xml xmp xorg xscreensaver xv xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="usb-audio" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="nvidia nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 8 Thomas Manni 2015-01-24 16:24:07 UTC
I'm on linux ubuntu 14.04 64bits (kernel 3.13.0) 

I tried several glib and json-glib versions combinations, the bug persists.
glib 2.40.0 and 2.42.1
json-glib 0.16.2 and 1.0.0

Maybe it can help:

In the code comment 4, https://bugzilla.gnome.org/show_bug.cgi?id=743296#c4
If I add a JsonParser instanciation 

JsonParser *parser = json_parser_new ();

before doing a call to gegl_node_new_child, the segfault disappears.
Comment 9 Jon Nordby 2015-01-24 16:49:51 UTC
BugsBunny, so it seems that for you the problem has dissapeared?

Thomas Manni, can you still reproduce the issue?
If so, can you break in json_parser_get_type and give the backtrace for the first hit, as well as how many times you see it called before crash?
Can you also run it under valgrind and attach the output of that?


I've ran the code under valgrind memcheck and exp-sgcheck, no errors for me. Tried to force issue to occur by changing order of files in filesystem, putting syntax errors in the .json file. Installed GIMP to custom prefix, system prefix. Also tried the example code above.

The crux of the crash is that the GQuark hash table has a NULL or otherwise invalid string.

A slight oddity is that I see the gegl_module_register of json.so being called twice, once from gegl_module_new() from gegl_init/gegl_option_context, the other from gegl_module_load() from g_type_module_use (like in backtraces when segfaulting), but this does not appear to cause problems here.

When running on Travis CI, I either get segfault every time GEGL is spawned, or never (about 30 attempts). So either crash only manifests on certain machines, or there is some variation in build process (different memory layout?) that triggers the issue.

I'm using json-glib 1.0.2 and glib2 2.42.1 on my local machine. Updating Travis to match now.
Comment 10 Jon Nordby 2015-01-24 18:58:56 UTC
Should be fixed in

commit 08c4063702aaecbb9b777706e7b469a3b171b877
Author: Jon Nordby <jononor@gmail.com>
Date:   Sat Jan 24 13:45:39 2015 -0500

    meta-json: Force module to be persistent
    
    Hopefully fixes segfault in some cases where libgegl/executable
    does not link json-glib, and the shared lib which GType database
    referred to was unloaded.
    https://bugzilla.gnome.org/show_bug.cgi?id=743296
Comment 11 BugsBunny 2015-01-25 14:07:45 UTC
Jon Nordby for me the problem disappeared only because I deleted /usr/lib64/gegl-0.3/grey2.json