Bonobo bug report



Package: bonobo
Version: CVS, 17/8/99
Severity: grave

I've been hacking on bonobo from CVS, and learning a lot about CORBA
and bonobo in the process. However, I came on this sporadic problem:
When trying to launch gnumeric from the test-container example,
from time to time, gnumeric crashes here

(gdb) i s 
#0 0x40621111 in __kill () 
#1 0x40620d66 in raise (sig=0x6) at ../sysdeps/posix/raise.c:27 
#2 0x40622447 in abort () at ../sysdeps/generic/abort.c:88 
#3 0x405d7861 in g_logv () 
#4 0x405d7912 in g_log () 
#5 0x80f11da in workbook_set_auto_expr (wb=0x8182048, description=0x813c45e
"Sum", expression=0x813c44d "SUM(SELECTION())") at workbook.c:1606 
#6 0x80f1dbb in workbook_init (object=0x8182048) at workbook.c:1914 
#7 0x403c89a4 in gtk_type_new (type=0xba15) at gtktypeutils.c:403 
#8 0x80f1e80 in workbook_new () at workbook.c:1979 
#9 0x8061a55 in WorkbookFactory_create_object (servant=0x814af78, goad_id=0x8181fd0
"IDL:GNOME:Gnumeric:Workbook:1.0", params=0xbffff64c, ev=0xbffff694)
at corba-workbook-factory.c:78 
#10 0x4054f5f5 in _ORBIT_skel_GNOME_GenericFactory_create_object (_ORBIT_servant=0x814af78,
_ORBIT_recv_buffer=0x81817d8, ev=0xbffff694, _impl_create_object=0x8061a18
<WorkbookFactory_create_object>) at gnome-factory-skels.c:111 
#11 0x40587015 in ORBit_POA_handle_request (recv_buffer=0x81817d8,
poa=0x81707c8) at orbit_poa.c:485 
#12 0x405899da in ORBit_handle_incoming_request (recv_buffer=0x81817d8)
at server.c:88 
#13 0x40589c99 in ORBit_handle_incoming_message (recv_buffer=0x81817d8)
at server.c:157 
#14 0x405b7e79 in giop_recv_reply_buffer_use_multiple_2 (request_cnx=0x8180c40,
request_ids=0xbffff72c, block_for_reply=0x1) at giop-msg-buffer.c:989 
#15 0x405b7f59 in giop_recv_reply_buffer_use_2 (request_cnx=0x8180c40,
request_id=0xbffff7b4, block_for_reply=0x1) at giop-msg-buffer.c:1023 
#16 0x4055db85 in CosNaming_NamingContext_resolve (_obj=0x816f64c,
n=0xbffff940, ev=0x8181a3c) at CosNaming-stubs.c:792 
#17 0x40554abd in goad_server_register (name_server=0x816f64c, server=0x8181aa0,
name=0x813d500 "GNOME:Gnumeric:GridFactory:1.0", kind=0x40116ee2 "server",
ev=0x8181a3c) at goad.c:1174 
#18 0x400f8f07 in gnome_embeddable_factory_construct (goad_id=0x813d500
"GNOME:Gnumeric:GridFactory:1.0", c_factory=0x8181a28, corba_factory=0x8181aa0,
factory=0x80f7d0c <embeddable_grid_factory>, data=0x0) at gnome-embeddable-factory.c:115 
#19 0x400f905b in gnome_embeddable_factory_new (goad_id=0x813d500 "GNOME:Gnumeric:GridFactory:1.0",
factory=0x80f7d0c <embeddable_grid_factory>, data=0x0) at gnome-embeddable-factory.c:160 
#20 0x80f7dac in EmbeddableGridFactory_init () at embeddable-grid.c:258 
#21 0x805ef6d in gnumeric_arg_parse (argc=0x3, argv=0xbffffa54) at
corba-args.c:36 
#22 0x805ed52 in gnumeric_main (closure=0x0, argc=0x3, argv=0xbffffa54)
at main.c:74 
#23 0x805eecc in main (argc=0x3, argv=0xbffffa54) at main.c:139 
#24 0x4061acb3 in __libc_start_main (main=0x805eeb0 <main>, argc=0x3,
argv=0xbffffa54, init=0x805c414 <_init>, fini=0x81144cc <_fini>, rtld_fini=0x4000a350
<_dl_fini>, stack_end=0xbffffa4c) at ../sysdeps/generic/libc-start.c:78

Gnumeric is attempting to register the grid factory with the nameserver.
However, when it enters the loop in giop_recv_reply_buffer_use_multiple_2
in order to await the reply from the nameserver, it receives and processes
the request from test-container. This causes it to attempt to create
a workbook before it is properly initialized (the global symbol table
which defines SUM() has not been initialized).

Perhaps the correct thing to do is to keep the POA manager in the
HOLDING state until the end of the initialization process.

Presently it is activated in bonobo_init, called from
gnumeric_arg_parse, and then again in _WorkbookFactory_init.

I suggest deferring the activation of the POA manager, possibly by
introducing a new function bonobo_activate() which should be called at
the very end of initialization, just before entering gtk_main().

Here's a patch to bonobo:

========================================================================

diff -U3 -r bonobo-old/bonobo/gnome-main.c bonobo/bonobo/gnome-main.c
--- bonobo-old/bonobo/gnome-main.c	Sat Jul 31 22:18:03 1999
+++ bonobo/bonobo/gnome-main.c	Thu Aug 19 11:59:30 1999
@@ -4,6 +4,7 @@
  *
  * Author:
  *    Miguel de Icaza (miguel@gnu.org)
+ *    Peter Wainwright (prw@wainpr.demon.co.uk)
  */
 #include <config.h>
 #include <bonobo/gnome-main.h>
@@ -11,7 +12,7 @@
 
 CORBA_ORB                 __bonobo_orb;
 PortableServer_POA        __bonobo_poa;
-PortableServer_POAManager __bonobo_poa_manager;
+PortableServer_POAManager __bonobo_poa_manager = NULL;
 
 /**
  * bonobo_init:
@@ -54,12 +55,45 @@
 		}
 	}
 	
-	PortableServer_POAManager_activate (manager, &ev);
+	/* If we do this, embedded components may try to process incoming
+	   requests before they are properly initialized - PRW */
+	/* PortableServer_POAManager_activate (manager, &ev); */
 	__bonobo_orb = orb;
 	__bonobo_poa = poa;
 	__bonobo_poa_manager = manager;
 
+	CORBA_exception_free (&ev);
 	return TRUE;
 }
 
+/**
+ * bonobo_activate:
+ *
+ * Activates the Bonobo POA manager registered by bonobo_init
+ * This should be called at the end of application initialization.
+ * 
+ * Returns %TRUE on success, or %FALSE on failure.
+ */
+gboolean
+bonobo_activate (void)
+{
+	CORBA_Environment ev;
+
+	CORBA_exception_init (&ev);
+
+	if (!__bonobo_poa_manager) {
+		g_warning ("Tried to activate Bonobo before initializing");
+		CORBA_exception_free (&ev);
+		return FALSE;
+	}
+	PortableServer_POAManager_activate (__bonobo_poa_manager, &ev);
+	if (ev._major != CORBA_NO_EXCEPTION){
+		g_warning ("Failed to activate the Bonobo POA manager");
+		CORBA_exception_free (&ev);
+		return FALSE;
+	}
+
+	CORBA_exception_free (&ev);
+	return TRUE;
+}
 
diff -U3 -r bonobo-old/bonobo/gnome-main.h bonobo/bonobo/gnome-main.h
--- bonobo-old/bonobo/gnome-main.h	Fri Jul 16 20:30:54 1999
+++ bonobo/bonobo/gnome-main.h	Thu Aug 19 12:01:30 1999
@@ -9,6 +9,7 @@
 gboolean   bonobo_init      (CORBA_ORB orb,
 			     PortableServer_POA poa,
 			     PortableServer_POAManager manager);
+gboolean   bonobo_activate  (void);
 
 extern CORBA_ORB                 __bonobo_orb;
 extern PortableServer_POA        __bonobo_poa;

========================================================================

The PortableServer_POAManager_activate() call should also be removed from
gnumeric, and replaced by bonobo_activate() after app initialization is
REALLY complete.

Peter Wainwright
Home: prw@wainpr.demon.co.uk     Work: peter.wainwright@nrpb.org.uk
http://www.wainpr.demon.co.uk    Fax: +44-870-052-3185
Visit the Opera Exchange Homepage at http://www.treda.co.uk/opex/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]