Subject Re: [ib-support] Firebird and threads
Author Ann W. Harrison
At 07:24 PM 11/1/2001 -0700, Brad Pepers wrote:

>I'm still trying to track down then why it doesn't work. I'm using Linux
>(Mandrake 8.0) and the Classic version of Firebird.

That's interesting. The classic version comes in two modest
varieties. One creates a new gds_inet for each incoming connection.
That process uses the libgds.so to access the database - each client
being a separate process. The other variant creates a server -
eventually a set of servers - which support several clients. My
guess is that the build you're using follows that model. Could you
verify that?

I believe the problem with local connections occurs only on Windows
where there is a "special" memory transport mechanism that was grafted
on at some point.

>Program received signal SIGSEGV, Segmentation fault.
>[Switching to Thread 2051 (LWP 9354)]
>0x4046798f in THD_restore_specific () from /usr/lib/libgds.so
>(gdb) bt
>#0 0x4046798f in THD_restore_specific () from /usr/lib/libgds.so
>#1 0x404c3ffc in return_success () from /usr/lib/libgds.so




THDD DLL_EXPORT THD_restore_specific (void)
{
/**************************************
*
* T H D _ r e s t o r e _ s p e c i f i c
*
**************************************
*
* Functional description
*
**************************************/
THDD current_context;

current_context = THD_get_specific();
put_specific (current_context->thdd_prior_context);

return current_context->thdd_prior_context;
}

#ifdef ANY_THREADING
#ifdef POSIX_THREADS
#define GET_SPECIFIC_DEFINED
THDD THD_get_specific (void)
{
/**************************************
*
* T H D _ g e t _ s p e c i f i c ( P O S I X )
*
**************************************
*
* Functional description
* Gets thread specific data and returns
* a pointer to it.
*
**************************************/

return ((THDD) pthread_getspecific (specific_key));

}
#endif /* POSIX_THREADS */
#endif /* ANY_THREADING */


>The error has also happened at other times in isc_sql_execute2 as well as
>isc_dsql_fetch so its not localized to isc_dsql_allocate_statement.

Right. It wouldn't be. It looks as if pthread_getspecific (specific_key)
is returning a thread context that doesn't have a prior context (or no
context at all) and the reference to current_context->thdd_prior_context
blows up. Interesting.


Regards,

Ann
www.ibphoenix.com
We have answers.