Re: Multi-threading fixes...



OK scratch that.  I just did some tests with lots of unsynchronised 
access to a multi-threaded CORBA server.  Approximately 1 in every 
thousand or so access results in a server side segfault, directly 
attributable to  the connection state being modified or destroyed while 
in use...  The scary thing is that a lot of these times the connection 
lock seems to be held!

This is going to be trickier than I though :-(

-justin

Justin Schoeman wrote:
> Hi Michael, sorry for dissapearing on Friday - the weekend caught up to 
> me ;-)...
> 
> Anyway, attached is the patch I am using at the moment, which includes:
> 1) Releasing the NameService object after registering the initial 
> service (allows "make check" to succeed if ORBNamingIOR is set).
> 
> 2) Closes off the race on a connection close.
> 
> I am still not all that happy about the second part of the patch - I 
> think the connection should be shut down cleanly (in a synchronous way), 
> before attempting to release its resources.  Unfortunately, I am not 
> clued up enough on the gnome object model to be 100% sure how to do this 
> the right way.
> 
> What I can say is that the patch seems to work in most cases. It passes 
> "make check", and works correctly under some pretty intense tests.
> 
> Thanks,
> -justin
> 
> 
> ------------------------------------------------------------------------
> 
> diff -urN ORBit2-2.9.0/src/orb/GIOP/giop-recv-buffer.c ORBit2-2.9.0-wks/src/orb/GIOP/giop-recv-buffer.c
> --- ORBit2-2.9.0/src/orb/GIOP/giop-recv-buffer.c	Thu Oct 23 15:30:38 2003
> +++ ORBit2-2.9.0-wks/src/orb/GIOP/giop-recv-buffer.c	Fri Oct 31 11:28:04 2003
> @@ -1167,26 +1167,35 @@
>  gboolean
>  giop_connection_handle_input (LinkConnection *lcnx)
>  {
> -	GIOPRecvBuffer *buf;
> +	GIOPRecvBuffer *buf, *tmp_buf = NULL;
>  	GIOPConnection *cnx = (GIOPConnection *) lcnx;
>  
>  	do {
>  		int n;
>  
> -		if (!cnx->incoming_msg)
> -			cnx->incoming_msg = giop_recv_buffer_use_buf ();
> -
> -		buf = cnx->incoming_msg;
> +		if (!cnx->incoming_msg) {
> +			tmp_buf = giop_recv_buffer_use_buf ();
> +			buf = tmp_buf;
> +		} else {
> +			buf = cnx->incoming_msg;
> +		}
>  
>  		n = link_connection_read (
>  			lcnx, buf->cur, buf->left_to_read, FALSE);
>  
> -		if (n == 0) /* We'll be back */
> +		if (n == 0) { /* We'll be back */
> +			if(tmp_buf) {
> +				cnx->incoming_msg = tmp_buf;
> +			}
>  			return TRUE;
> +		}
>  
>  		if (n < 0 || !buf->left_to_read) { /* HUP */
> -			link_connection_state_changed (lcnx, LINK_DISCONNECTED);
> -			return TRUE;
> +			goto msg_error;
> +		}
> +		
> +		if(tmp_buf) {
> +			cnx->incoming_msg = tmp_buf;
>  		}
>  
>  /*		fprintf (stderr, "Read %d\n", n);
> diff -urN ORBit2-2.9.0/src/orb/orb-core/corba-orb.c ORBit2-2.9.0-wks/src/orb/orb-core/corba-orb.c
> --- ORBit2-2.9.0/src/orb/orb-core/corba-orb.c	Thu Oct 23 15:30:38 2003
> +++ ORBit2-2.9.0-wks/src/orb/orb-core/corba-orb.c	Fri Oct 31 09:59:07 2003
> @@ -294,6 +294,7 @@
>  			 * IDL:omg.org/CosNaming/NamingContext using _is_a()
>  			 * operation */ 
>  			ORBit_set_initial_reference (orb, "NameService", objref);
> +			ORBit_RootObject_release (objref);
>  		}
>  	}
>  




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