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 325550 - g_logv [gmessage.c] crash various apps
g_logv [gmessage.c] crash various apps
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Shell
2.6.x
Other Linux
: Urgent critical
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks: 327508 327510
 
 
Reported: 2006-01-02 21:52 UTC by Ali Akcaagac
Modified: 2013-09-13 01:00 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
Fix for the crash. (2.03 KB, patch)
2006-02-23 13:30 UTC, Veerapuram Varadhan
none Details | Review

Description Ali Akcaagac 2006-01-02 21:52:11 UTC
I found out that Evolution from CVS HEAD crashes permanently during startup. After debugging I figured out that the backtrace leads to gmessage.c line 503 which points to:

g_private_set (g_log_depth, GUINT_TO_POINTER(depth));

I then recompiled glib by always returning from the function as seen below and Evolution and some other programs kept working again. Might be that something is wrong with this function ?

void
g_logv (const gchar   *log_domain,
	GLogLevelFlags log_level,
	const gchar   *format,
	va_list	       args1)
{
  gboolean was_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
  gboolean was_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0;
  gint i;

  log_level &= G_LOG_LEVEL_MASK;
  if (!log_level)
    return;
 
return;          <----- my return

  for (i = g_bit_nth_msf (log_level, -1); i >= 0; i = g_bit_nth_msf (log_level, i))
    {
      register GLogLevelFlags test_level;
      
      test_level = 1 << i;
      if (log_level & test_level)
	{
	  guint depth = GPOINTER_TO_UINT (g_private_get (g_log_depth));
	  GLogDomain *domain;
	  GLogFunc log_func;
	  GLogLevelFlags domain_fatal_mask;
	  gpointer data = NULL;

	  if (was_fatal)
	    test_level |= G_LOG_FLAG_FATAL;
	  if (was_recursion)
	    test_level |= G_LOG_FLAG_RECURSION;

	  /* check recursion and lookup handler */
	  g_mutex_lock (g_messages_lock);
	  domain = g_log_find_domain_L (log_domain ? log_domain : "");
	  if (depth)
	    test_level |= G_LOG_FLAG_RECURSION;
	  depth++;
	  domain_fatal_mask = domain ? domain->fatal_mask : G_LOG_FATAL_MASK;
	  if ((domain_fatal_mask | g_log_always_fatal) & test_level)
	    test_level |= G_LOG_FLAG_FATAL;
	  if (test_level & G_LOG_FLAG_RECURSION)
	    log_func = _g_log_fallback_handler;
	  else
	    log_func = g_log_domain_get_handler_L (domain, test_level, &data);
	  domain = NULL;
	  g_mutex_unlock (g_messages_lock);

	  g_private_set (g_log_depth, GUINT_TO_POINTER (depth));

	  /* had to defer debug initialization until we can keep track of recursion */
	  if (!(test_level & G_LOG_FLAG_RECURSION) && !_g_debug_initialized)
	    {
	      GLogLevelFlags orig_test_level = test_level;

	      _g_debug_init ();
	      if ((domain_fatal_mask | g_log_always_fatal) & test_level)
		test_level |= G_LOG_FLAG_FATAL;
	      if (test_level != orig_test_level)
		{
		  /* need a relookup, not nice, but not too bad either */
		  g_mutex_lock (g_messages_lock);
		  domain = g_log_find_domain_L (log_domain ? log_domain : "");
		  log_func = g_log_domain_get_handler_L (domain, test_level, &data);
		  domain = NULL;
		  g_mutex_unlock (g_messages_lock);
		}
	    }

	  if (test_level & G_LOG_FLAG_RECURSION)
	    {
	      /* we use a stack buffer of fixed size, since we're likely
	       * in an out-of-memory situation
	       */
	      gchar buffer[1025];
	      gint size;
	      size = _g_vsnprintf (buffer, 1024, format, args1);

	      log_func (log_domain, test_level, buffer, data);
	    }
	  else
	    {
	      gchar *msg = g_strdup_vprintf (format, args1);

	      log_func (log_domain, test_level, msg, data);

	      g_free (msg);
	    }

	  if (test_level & G_LOG_FLAG_FATAL)
	    {
#ifdef G_OS_WIN32
	      gchar *locale_msg = g_locale_from_utf8 (fatal_msg_buf, -1, NULL, NULL, NULL);
	      
	      MessageBox (NULL, locale_msg, NULL,
			  MB_ICONERROR|MB_SETFOREGROUND);
	      if (IsDebuggerPresent () && !(test_level & G_LOG_FLAG_RECURSION))
		G_BREAKPOINT ();

	      abort ();
#else
#if defined (G_ENABLE_DEBUG) && defined (SIGTRAP)
	      if (!(test_level & G_LOG_FLAG_RECURSION))
		G_BREAKPOINT ();
	      else
		abort ();
#else /* !G_ENABLE_DEBUG || !SIGTRAP */
	      abort ();
#endif /* !G_ENABLE_DEBUG || !SIGTRAP */
#endif /* !G_OS_WIN32 */
	    }
	  
	  depth--;
	  g_private_set (g_log_depth, GUINT_TO_POINTER (depth));
	}
    }
}
Comment 1 Matthias Clasen 2006-01-03 03:13:19 UTC
Hard to say, without at least a stacktrace. 
Evolution 2.5.3 starts up fine with glib HEAD here...
Comment 2 Ali Akcaagac 2006-01-03 05:55:14 UTC
galaxy@ulixys:~ > gdb evolution
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run
Starting program: /usr/local/bin/evolution
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 1867)]

(evolution:1867): camel-WARNING **: camel_exception_get_id called with NULL parameter.
[New Thread 32769 (LWP 1870)]
[New Thread 16386 (LWP 1871)]
[New Thread 32771 (LWP 1872)]
[New Thread 49156 (LWP 1873)]
[New Thread 65541 (LWP 1874)]
[New Thread 81926 (LWP 1875)]

Bonobo-CRITICAL **: bonobo_ui_component_set_prop: assertion `BONOBO_IS_UI_COMPONENT (component)' failed
aborting...

Program received signal SIGTRAP, Trace/breakpoint trap.

Thread 16384 (LWP 1867)

  • #0 IA__g_logv
    at gmessages.c line 493
  • #1 IA__g_log
    at gmessages.c line 517
  • #2 IA__g_return_if_fail_warning
  • #3 bonobo_ui_component_set_prop
    from /usr/local/lib/libbonoboui-2.so.0
  • #4 emfv_setting_notify
    at em-folder-view.c line 2717
  • #5 emfv_setting_setup
    at em-folder-view.c line 2777
  • #6 emfv_init
    at em-folder-view.c line 231
  • #7 IA__g_type_create_instance
    at gtype.c line 1559
  • #8 g_object_constructor
    at gobject.c line 1015
  • #9 IA__g_object_newv
    at gobject.c line 912
  • #10 IA__g_object_new_valist
    at gobject.c line 955
  • #11 IA__g_object_new
    at gobject.c line 793
  • #12 em_folder_browser_new
    at em-folder-browser.c line 320
  • #13 impl_createView
    at mail-component.c line 638
  • #14 _ORBIT_skel_small_GNOME_Evolution_Component_createView
    at Evolution-common.c line 56
  • #15 ORBit_c_stub_invoke
    from /usr/local/lib/libORBit-2.so.0
  • #16 GNOME_Evolution_Component_createView
    at Evolution-stubs.c line 88
  • #17 init_view
    at e-shell-window.c line 243
  • #18 switch_view
    at e-shell-window.c line 316
  • #19 sidebar_button_selected_callback
    at e-shell-window.c line 441
  • #20 IA__g_cclosure_marshal_VOID__INT
    at gmarshal.c line 216
  • #21 IA__g_closure_invoke
    at gclosure.c line 490
  • #22 signal_emit_unlocked_R
    at gsignal.c line 2438
  • #23 IA__g_signal_emit_valist
    at gsignal.c line 2197
  • #24 IA__g_signal_emit
    at gsignal.c line 2241
  • #25 e_sidebar_select_button
    at e-sidebar.c line 537
  • #26 e_shell_window_switch_to_component
    at e-shell-window.c line 999
  • #27 e_shell_window_new
    at e-shell-window.c line 959
  • #28 e_shell_create_window
    at e-shell.c line 937
  • #29 idle_cb
    at main.c line 380
  • #30 g_idle_dispatch
    at gmain.c line 3761
  • #31 g_main_dispatch
    at gmain.c line 1913
  • #32 IA__g_main_context_dispatch
    at gmain.c line 2463
  • #33 g_main_context_iterate
    at gmain.c line 2544
  • #34 IA__g_main_loop_run
    at gmain.c line 2748
  • #35 bonobo_main
    from /usr/local/lib/libbonobo-2.so.0
  • #36 main
    at main.c line 606
    argDescrip = 0x0}, {longName = 0x0, shortName = 0 '\0', argInfo = 0,
    arg = 0x0, val = 0, descrip = 0x0, argDescrip = 0x0}}
        client = (GConfClient *) 0x80a36f0
        skip_warning_dialog = 1
        uri_list = (GSList *) 0x0
        popt_context_value = {g_type = 0, data = {{v_int = 0, v_uint = 0,
      v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0,
      v_double = 0, v_pointer = 0x0}, {v_int = 0, v_uint = 0, v_long = 0,
      v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0,
      v_pointer = 0x0}}}
        program = (GnomeProgram *) 0x806e1b0
        popt_context = 0x8074140
        args = (const char **) 0x0
        icon_list = (GList *) 0x80ca1a0
        filename = 0x805f020 "U\211\uffff\203\uffff\030\211]\uffff\uffffO"
(gdb) q
The program is running.  Exit anyway? (y or n) y
galaxy@ulixys:~ >
Comment 3 Olav Vitters 2006-01-03 08:25:14 UTC
Believe this is the announced abort-on-critical error change after 2006-01-01 set by gnome-session.

Does the following:
  putenv ("G_DEBUG=fatal_criticals");
  g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL);
Comment 4 Matthias Clasen 2006-01-03 12:10:28 UTC
Yes. Its time for evolution to start caring about the critical warnings it spews...
Comment 5 Federico Mena Quintero 2006-01-03 16:39:56 UTC
Was this indeed FIXED?
Comment 6 Matthias Clasen 2006-01-03 16:46:48 UTC
Sorry, didn't mean to close this.
Comment 7 Ali Akcaagac 2006-01-03 21:14:00 UTC
I've altered a handful of values - hope you don't mind. Crashes are usually critical somehow.
Comment 8 Federico Mena Quintero 2006-01-03 22:00:21 UTC
How do you reproduce the bug?  Just by switching components in Evolution?

In any case, this is pretty bad - look at frames 3, 4, 5 in the stack trace.  The critical warning means Evolution is passing an invalid BonoboUIComponent to the Bonobo functions.  It's most likely calling bonobo_ui_component_*() functions before the component is activated, so there is no UIC yet (see emfv_activate()).
Comment 9 Federico Mena Quintero 2006-01-03 22:01:53 UTC
emfv_setting_notify() probably just needs to check for emfv->uic != NULL before calling bonobo_ui_component_*() functions on it.  emfv_activate() will change the properties of the UI elements as appropriate.
Comment 10 Karsten Bräckelmann 2006-01-14 23:53:47 UTC
Please not this is a "critical warning" bug, which is a crasher since 01/01/2006 in CVS. Adjusting Priority.
Comment 11 Ali Akcaagac 2006-01-27 03:15:23 UTC
Sorry, but I am getting this with other applications as well, such as Nautilus when pointing the mouse on the "Go" menu item and various other apps. I had to put an explicit return in g_logv inside glib code to have the apps working "normally" again.
Comment 12 Federico Mena Quintero 2006-01-27 16:23:02 UTC
(In reply to comment #11)
> Sorry, but I am getting this with other applications as well, such as Nautilus
> when pointing the mouse on the "Go" menu item and various other apps. I had to
> put an explicit return in g_logv inside glib code to have the apps working
> "normally" again.

This indicates a bug in Nautilus or in one of the underlying libraries --- this is exactly the kind of bugs we want to catch early with the crash-on-critical-warning thing.  Could you please file a bug with a stack trace for Nautilus?  Thanks :)
Comment 13 Kjartan Maraas 2006-02-16 12:06:30 UTC
Or you could just patch gnome-session so it doesn't use G_DEBUG=fatal_criticals instead if you don't want this to happen. We're slowly fixing the critical warnings though and I'm able to run my desktop most of the time without problems these days. (Unless I enable a11y that is :-)
Comment 14 Veerapuram Varadhan 2006-02-23 13:30:21 UTC
Created attachment 60000 [details] [review]
Fix for the crash.
Comment 15 Kjartan Maraas 2006-02-28 10:19:00 UTC
Ali, does this patch fix it for you?
Comment 16 André Klapper 2006-03-01 22:23:47 UTC
seems like bug 325375 is a duplicate, so confirming this here.
(dunno why #325375 was closed as fixed though.)
Comment 17 André Klapper 2006-03-24 20:00:30 UTC
ali: does the patch by veerapuram work for you?
Comment 18 Christian Neumair 2006-04-03 10:59:41 UTC
Ali? Setting to NEEDINFO.
Comment 19 Ali Akcaagac 2006-04-04 04:08:05 UTC
Greetings!

Sorry for the big delay, but I've been busy with my new job and thus hadn't had time dealing with all this. I now had time last weekend to compile a new GNOME from CVS and I so far can confirm that this problem has been solved.
Comment 20 Matthias Clasen 2006-04-04 11:38:22 UTC
Thanks for checking