BUG #4049: ecpg library causes signal 11 when --enable-thread-safety is turned on

From: "Steve Clark" <sclark(at)netwolves(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4049: ecpg library causes signal 11 when --enable-thread-safety is turned on
Date: 2008-03-22 15:35:11
Message-ID: 200803221535.m2MFZBPh072909@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4049
Logged by: Steve Clark
Email address: sclark(at)netwolves(dot)com
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.

Browse pgsql-bugs by date

  From Date Subject
Next Message Vladimir Kokovic 2008-03-22 19:04:32 BUG #4050: pg_dump data contains COMMIT statement (8.3, 8.4)
Previous Message Bruce Momjian 2008-03-22 01:33:00 Re: BUG #3833: Index remains when table is dropped