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 681561 - Gedit crashes on syntax highlighting, that file is never openable again.
Gedit crashes on syntax highlighting, that file is never openable again.
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
3.4.x
Other Linux
: High major
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2012-08-09 22:19 UTC by James
Modified: 2013-11-04 20:45 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description James 2012-08-09 22:19:55 UTC
While using gedit to edit a templated httpd ssl.conf file (ssl.conf.erb -> puppet templated file) I was trying to find a syntax highlighter which would approximate the logical highlighting of the file.

I clicked on Highlight Mode -> Others -> Default

and gedit crashed.

On restarting gedit, everytime I would go to open the file it would crash gedit.

Running gedit in a terminal produces:

<snip random gedit errors such as:>

(gedit:16742): Gdk-CRITICAL **: gdk_window_invalidate_rect_full: assertion `GDK_IS_WINDOW (window)' failed

(gedit:16742): Gtk-CRITICAL **: gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
</snip>

# the real crasher is here:

**
GtkSourceView:ERROR:gtksourcecontextengine.c:5487:update_syntax: assertion failed: (state->context != NULL)
Aborted

The workaround to solve this issue is to use gvfs to "clear" the highlight status of that file:

$ gvfs-set-attribute tmp/ssl.conf.erb metadata::gedit-language ''

And now I can open that file again. This however does not fix the highlight crasher and obviously it should either never crash, or if it does, at least let you open the file and pick a different highlight mode.

Hope this is clear enough,
100% reproducible.

Cheers,
James

PS: syntax highlighting for .pp (puppet) files in gedit would be awesome!
Comment 1 James 2012-08-09 22:20:58 UTC
Setting to major since the average user probably can't solve this problem on their own. Feel free to change as you see fit, I won't be offended :)
Comment 2 André Klapper 2012-08-10 07:17:23 UTC
Thanks for taking the time to report this bug.
Without a stack trace from the crash it's very hard to determine what caused it.
Can you get us a stack trace? Please see http://live.gnome.org/GettingTraces for more information on how to do so. Thanks in advance!
Comment 3 James 2012-08-10 15:39:36 UTC
Hi there,

If need be I will go and get one, can you first try this on your machine and see if you get the same result? If so, you'll have all the information right there.

It's very easy to reproduce, I believe. If not, let me know.

Thank you,
James
Comment 4 André Klapper 2012-08-10 15:52:34 UTC
I don't have 3.4 on this machine.
Comment 5 Paolo Borelli 2012-08-10 16:06:09 UTC
Can you attach the a file that triggers the problem?


(puppet highlighting support has been added a few days ago :)
Comment 6 James 2012-08-10 16:25:39 UTC
@paolo: you guys are awesome, thank you!

@andre
what I did:

$ sudo debuginfo-install gedit
[snip]

$ gedit some-file-that-i-am-using-for-debugging-bug
**
GtkSourceView:ERROR:gtksourcecontextengine.c:5487:update_syntax: assertion failed: (state->context != NULL)
Aborted
$ mv some-file-that-i-am-using-for-debugging-bug some-file-that-i-am-using-for-debugging-bug2
$ gdb gedit 
GNU gdb (GDB) Fedora (7.4.50.20120120-49.fc17)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/gedit...Reading symbols from /usr/lib/debug/usr/bin/gedit.debug...done.
done.
(gdb) run /tmp/some-file-that-i-am-using-for-debugging-bug2
Starting program: /usr/bin/gedit /tmp/some-file-that-i-am-using-for-debugging-bug2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffe7c74700 (LWP 29903)]
[New Thread 0x7fffe7473700 (LWP 29904)]
[New Thread 0x7fffe6a6a700 (LWP 29905)]
[New Thread 0x7fffce953700 (LWP 29906)]
[Thread 0x7fffce953700 (LWP 29906) exited]
**
GtkSourceView:ERROR:gtksourcecontextengine.c:5487:update_syntax: assertion failed: (state->context != NULL)

Program received signal SIGABRT, Aborted.
0x00007ffff37e9925 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64	  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
Missing separate debuginfos, use: debuginfo-install GConf2-3.2.5-1.fc17.x86_64 adwaita-gtk3-theme-3.4.2-1.fc17.x86_64 aspell-0.60.6.1-3.fc17.x86_64 dbus-glib-0.98-2.fc17.x86_64 dbus-libs-1.4.10-4.fc17.x86_64 dbus-python-0.83.0-9.fc17.x86_64 dconf-0.12.1-1.fc17.x86_64 expat-2.1.0-1.fc17.x86_64 fontconfig-2.8.0-7.fc17.x86_64 freetype-2.4.8-3.fc17.x86_64 gamin-0.1.10-12.fc17.x86_64 gvfs-1.12.3-1.fc17.x86_64 hunspell-1.3.2-4.fc17.x86_64 keyutils-libs-1.5.5-2.fc17.x86_64 krb5-libs-1.10.2-6.fc17.x86_64 libXau-1.0.6-3.fc17.x86_64 libXcomposite-0.4.3-3.fc17.x86_64 libXcursor-1.1.13-1.fc17.x86_64 libXdamage-1.1.3-3.fc17.x86_64 libXext-1.3.1-1.fc17.x86_64 libXfixes-5.0-2.fc17.x86_64 libXi-1.6.1-1.fc17.x86_64 libXinerama-1.1.2-1.fc17.x86_64 libXrandr-1.3.1-3.fc17.x86_64 libXrender-0.9.7-1.fc17.x86_64 libbluray-0.2.2-1.fc17.x86_64 libcanberra-0.28-6.fc17.x86_64 libcanberra-gtk3-0.28-6.fc17.x86_64 libcom_err-1.42.3-2.fc17.x86_64 libcroco-0.6.5-1.fc17.x86_64 libgcc-4.7.0-5.fc17.x86_64 libogg-1.3.0-1.fc17.x86_64 libpng-1.5.10-1.fc17.x86_64 librsvg2-2.36.1-1.fc17.x86_64 libselinux-2.1.10-3.fc17.x86_64 libstdc++-4.7.0-5.fc17.x86_64 libtdb-1.2.10-15.fc17.x86_64 libtool-ltdl-2.4.2-3.fc17.x86_64 libuuid-2.21.2-2.fc17.x86_64 libvorbis-1.3.3-1.fc17.x86_64 libxcb-1.8.1-1.fc17.x86_64 libzeitgeist-0.3.18-1.fc17.x86_64 nss-softokn-freebl-3.13.5-1.fc17.x86_64 openssl-1.0.0j-2.fc17.x86_64 pixman-0.24.4-2.fc17.x86_64 pygobject3-3.2.2-1.fc17.x86_64 python-libs-2.7.3-7.2.fc17.x86_64 zlib-1.2.5-6.fc17.x86_64
(gdb) quit
A debugging session is active.

	Inferior 1 [process 29900] will be killed.

Quit anyway? (y or n) y
$ uname -a
Linux freed 3.4.4-5.fc17.x86_64 #1 SMP Thu Jul 5 20:20:59 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux



Hope this is what you wanted...


Thanks,
James
Comment 7 André Klapper 2012-08-10 16:28:54 UTC
> (gdb) quit

Could you enter 
   thread apply all bt
here instead so we can get the stacktrace of the crash? :)
Comment 8 James 2012-08-10 16:36:29 UTC
@andre: so sorry, my gdb foo is apparently quite weak... hopefully this is now correct.


$ mv some-file-that-i-am-using-for-debugging-bug{2,3}
$ gdb gedit
GNU gdb (GDB) Fedora (7.4.50.20120120-49.fc17)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/gedit...Reading symbols from /usr/lib/debug/usr/bin/gedit.debug...done.
done.
(gdb) run some-file-that-i-am-using-for-debugging-bug3
Starting program: /usr/bin/gedit some-file-that-i-am-using-for-debugging-bug3
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffe7c74700 (LWP 30429)]
[New Thread 0x7fffe7473700 (LWP 30430)]
[New Thread 0x7fffe6a6a700 (LWP 30431)]
[New Thread 0x7fffce4d4700 (LWP 30433)]
[Thread 0x7fffce4d4700 (LWP 30433) exited]
**
GtkSourceView:ERROR:gtksourcecontextengine.c:5487:update_syntax: assertion failed: (state->context != NULL)

Program received signal SIGABRT, Aborted.
0x00007ffff37e9925 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64	  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
Missing separate debuginfos, use: debuginfo-install GConf2-3.2.5-1.fc17.x86_64 adwaita-gtk3-theme-3.4.2-1.fc17.x86_64 aspell-0.60.6.1-3.fc17.x86_64 dbus-glib-0.98-2.fc17.x86_64 dbus-libs-1.4.10-4.fc17.x86_64 dbus-python-0.83.0-9.fc17.x86_64 dconf-0.12.1-1.fc17.x86_64 expat-2.1.0-1.fc17.x86_64 fontconfig-2.8.0-7.fc17.x86_64 freetype-2.4.8-3.fc17.x86_64 gamin-0.1.10-12.fc17.x86_64 gvfs-1.12.3-1.fc17.x86_64 hunspell-1.3.2-4.fc17.x86_64 keyutils-libs-1.5.5-2.fc17.x86_64 krb5-libs-1.10.2-6.fc17.x86_64 libXau-1.0.6-3.fc17.x86_64 libXcomposite-0.4.3-3.fc17.x86_64 libXcursor-1.1.13-1.fc17.x86_64 libXdamage-1.1.3-3.fc17.x86_64 libXext-1.3.1-1.fc17.x86_64 libXfixes-5.0-2.fc17.x86_64 libXi-1.6.1-1.fc17.x86_64 libXinerama-1.1.2-1.fc17.x86_64 libXrandr-1.3.1-3.fc17.x86_64 libXrender-0.9.7-1.fc17.x86_64 libbluray-0.2.2-1.fc17.x86_64 libcanberra-0.28-6.fc17.x86_64 libcanberra-gtk3-0.28-6.fc17.x86_64 libcom_err-1.42.3-2.fc17.x86_64 libcroco-0.6.5-1.fc17.x86_64 libgcc-4.7.0-5.fc17.x86_64 libogg-1.3.0-1.fc17.x86_64 libpng-1.5.10-1.fc17.x86_64 librsvg2-2.36.1-1.fc17.x86_64 libselinux-2.1.10-3.fc17.x86_64 libstdc++-4.7.0-5.fc17.x86_64 libtdb-1.2.10-15.fc17.x86_64 libtool-ltdl-2.4.2-3.fc17.x86_64 libuuid-2.21.2-2.fc17.x86_64 libvorbis-1.3.3-1.fc17.x86_64 libxcb-1.8.1-1.fc17.x86_64 libzeitgeist-0.3.18-1.fc17.x86_64 nss-softokn-freebl-3.13.5-1.fc17.x86_64 openssl-1.0.0j-2.fc17.x86_64 pixman-0.24.4-2.fc17.x86_64 pygobject3-3.2.2-1.fc17.x86_64 python-libs-2.7.3-7.2.fc17.x86_64 zlib-1.2.5-6.fc17.x86_64
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff09089c0 (LWP 30426))

  • #0 __GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #1 __GI_abort
    at abort.c line 91
  • #2 g_assertion_message
    at gtestutils.c line 1861
  • #3 g_assertion_message_expr
    at gtestutils.c line 1872
  • #4 update_syntax
    at gtksourcecontextengine.c line 5487
  • #5 first_update_callback
    at gtksourcecontextengine.c line 2381
  • #6 gdk_threads_dispatch
    at gdk.c line 763
  • #7 g_main_dispatch
    at gmain.c line 2539
  • #8 g_main_context_dispatch
    at gmain.c line 3075
  • #9 g_main_context_iterate
    at gmain.c line 3146
  • #10 g_main_loop_run
    at gmain.c line 3340
  • #11 gtk_main
    at gtkmain.c line 1161
  • #12 gedit_main
    at gedit.c line 205
  • #13 main
    at gedit.c line 331
A debugging session is active.

	Inferior 1 [process 30426] will be killed.

Quit anyway? (y or n) y
$
Comment 9 José Aliste 2012-08-13 15:40:26 UTC
James, the stacktrace now is good, but could you please attach the file that makes gedit crash? If possible, erase sensible private information from it. If you feel so, you can send it to me privately at the address: jaliste at gnome.org
Comment 10 James 2012-08-13 16:26:08 UTC
José, here you go:

$ cat /tmp/some-file-that-i-am-using-for-debugging-bug3 
this is some file that i am using for debugging

James
Comment 11 José Aliste 2012-08-14 00:07:51 UTC
I can confirm the crash here...  Seems to happen only on Defaults highlighting mode. Digging
Comment 12 Michael Catanzaro 2013-01-04 00:43:53 UTC
Fedora abrt bug: https://bugzilla.redhat.com/show_bug.cgi?id=832008
Comment 13 Sebastien Bacher 2013-03-28 15:03:43 UTC
similar bug on Ubuntu:
https://bugs.launchpad.net/ubuntu/+source/gtksourceview3/+bug/1096144

the issue seems to be trivial to trigger by picking "default" in the syntax choice

note that it's the most reported gedit issue on the Ubuntu error tracker with 718 reports this month, it's still an issue on GNOME 3.6 (didn't try 3.8 yet)
Comment 14 José Aliste 2013-03-30 03:09:02 UTC
... I just realized that there is another bug related, Defaults is a internal lang file that should not be available to the user... So, filed bug https://bugzilla.gnome.org/show_bug.cgi?id=696889 with a patch. The side-effect of the patch is that after applying the user can not longer select the Defaults language, so it will prevent the crash from happening. @Sebastian, so you can probably use the patch in the bug above to solve this in Ubuntu. 

I would prefer to leave this bug open so we have a remainder that some language files make gedit to crash, and since the patch above does not really fix the issue but just workaround it.
Comment 15 Sébastien Wilmet 2013-11-04 20:45:10 UTC
I think the failed assertion was because the Default highlight mode was used. Since the Default highlight mode can no longer be used, I close this bug.

Otherwise, there are other critical bugs in GtkSourceView about the context engine.