Re: ORBit2.8.3 thread problem


I did some tests with echo-client-t.c (add a echo_client_thread(NULL) just before g_thread_join(), means invoke CORBA method from main thread) against different ORBit2 version.

The modified echo-client-t.c fail to run on ORBit2-2.8.x but it's OK to run on ORBit-2.10.x. It looks like a client side bug ... use server from 2.10.x and echo-client-t.c
from 2.8.x will hang up too.

Well, I still wonder what's wrong with thread support on 2.8.x.

Kuang-Chun Cheng
kccheng openate com

nshmyrev wrote:

Well, I still can't reproduce you problems.
Let's do the following:

1. Please, upgrade ORBit for latest version. I use 2.10 and probably, your bug is already fixed there.

2. Let's reproduce you problem with your modification of echo-client-t.c from ORBit's test, since your first test is uncomplete (there is no server and I don't know what etk_ functions are doing). So, let's use echo-client-t.c for test (If problem is reproduced with new ORBit). Of course, modify it with echo_client_thread (NULL) as in your last mail.

3. After all, try to attach with gdb (do gdb --pid=pid)to process which hands up and do such commands:
a) info threads.
b) for every thread do backtrace with two gdb command (thread <number> then backtrace).

Let's see there results.

#include <stdio.h>
#include <stdlib.h>

#include "echo.h"

int niters = 100000;
int nthreads = 8;
char *server_ior;

static gpointer
echo_client_thread (gpointer data)
	int i;
	Echo echo_client;
	CORBA_Environment *ev, real_ev;

	CORBA_exception_init ((ev = &real_ev));

	echo_client = CORBA_ORB_string_to_object (orb, server_ior, ev);
	if (!echo_client) {
		g_error ("[%p]: Cannot bind to %s\n",
			 g_thread_self (), server_ior);
		return NULL;
	for (i = 0; i < 4; i++) /* let others get started */
		g_thread_yield ();

	for (i = 0; i < niters; i++) {
		char *str;
		CORBA_double tmp;
		Echo retval;
		str = g_strdup_printf ("[%p]: Hello, world [%d]",
				       g_thread_self (), i);

		Echo_doOneWay (echo_client, str, ev);
		retval = Echo_echoString (echo_client, str, &tmp, ev);

		g_free (str);

		if (ev->_major != CORBA_NO_EXCEPTION) {
			g_error ("[%p]: we got exception %s from echoString!\n",
				 g_thread_self (), ev->_id);
			return NULL;

		CORBA_Object_release (retval, ev);

	CORBA_Object_release (echo_client, ev);

	return data;

main (int argc, char *argv[])
	int i;
	GError *error = NULL;
	GThread **threads;
	CORBA_Environment *ev, real_ev;

	CORBA_exception_init ((ev = &real_ev));

	orb = CORBA_ORB_init (&argc, argv, "orbit-local-mt-orb", ev);

	if (argc < 2) {
		g_error ("Syntax: %s <server IOR> [<niters> [<nthreads>] ]\n",
			 argv [0]);
		return 1;
	server_ior = argv [1];

	if (argc >= 3)
		niters = atoi (argv [2]);

	if (argc >= 4)
		nthreads = atoi (argv [3]);

	threads = g_new0 (GThread *, nthreads);

	for (i = 0; i < nthreads; i++) {
		threads [i] = g_thread_create (
			echo_client_thread, &threads[i],
			TRUE, &error);
		if (error)
			g_error ("Error spawning threads '%s'", 

	# add this call will hang up for ORBit2-2.8.x, but work fine
	# for ORBit2-2.10.x.
	echo_client_thread (NULL);

	for (i = 0; i < nthreads; i++) {
		if (!(g_thread_join (threads [i]) == &threads [i]))
			g_error ("Wierd thread join problem '%d'", i);

	CORBA_ORB_destroy (orb, ev);
	CORBA_Object_release ((CORBA_Object) orb, ev);

	return 0;

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