The following bug has been logged online:

Bug reference:      4049
Logged by:          Steve Clark
Email address:      [EMAIL PROTECTED]
PostgreSQL version: 8.3.1
Operating system:   FreeBSD 6.2 patch level 7
Description:        ecpg library causes signal 11 when
--enable-thread-safety is turned on
Details: 

The ports for Freebsd turn on --enable-thread-safety during configure 
of pg.

When running my app after some time I have been getting a core dump - 
sig 11.

#0  0x28333b96 in memcpy () from /lib/libc.so.6
(gdb) bt
#0  0x28333b96 in memcpy () from /lib/libc.so.6
#1  0x280d0122 in ecpg_init_sqlca (sqlca=0x0) at misc.c:100
#2  0x280d0264 in ECPGget_sqlca () at misc.c:145
#3  0x280d056c in ecpg_log (
     format=0x280d1d78 "free_params line %d: parameter %d = %s\n") at 
misc.c:243
#4  0x280c9758 in free_params (paramValues=0x836fe00, nParams=104, 
print=1 '\001',
     lineno=3303) at execute.c:1045
#5  0x280c9f08 in ecpg_execute (stmt=0xa726f00) at execute.c:1298
#6  0x280ca978 in ECPGdo (lineno=3303, compat=0, force_indicator=1,
     connection_name=0x0, questionmarks=0 '\0', st=0,
     query=0x806023c "update T_UNIT_STATUS_LOG set ip_address  =  $1 
:: inet   , last_ip_address  =  $2  :: inet   , unit_date  =  $3  :: 
timestamp with time zone  , unit_raw_time  =  $4  , status_date  = now 
() , unit_ac"...) at execute.c:1636
#7  0x08057a46 in UpdateTUSL (pCachedUnit=0x807b680, msg=0xbfbf8850 "",
     p_threshold=80, p_actualIP=0xbfbfe880 "24.39.85.226")
     at srm2_monitor_db.pgc:3303
#8  0x0804f174 in main (argc=3, argv=0xbfbf7fc0) at 
srm2_monitor_server.c:3265
(gdb) f 2
#2  0x280d0264 in ECPGget_sqlca () at misc.c:145
145                     ecpg_init_sqlca(sqlca);
(gdb) p sqlca
$1 = (struct sqlca_t *) 0x0

in looking in the code in misc.c

I see:

struct sqlca_t *
ECPGget_sqlca(void)
{
#ifdef ENABLE_THREAD_SAFETY
        struct sqlca_t *sqlca;

        pthread_once(&sqlca_key_once, ecpg_sqlca_key_init);

        sqlca = pthread_getspecific(sqlca_key);
        if (sqlca == NULL)
        {
                sqlca = malloc(sizeof(struct sqlca_t));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                ecpg_init_sqlca(sqlca);
                pthread_setspecific(sqlca_key, sqlca);
        }
        return (sqlca);
#else
        return (&sqlca);
#endif
}

The return from malloc should be checked to make sure it succeeds otherwise
it generates a sig 11.

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to