agora inbox for postgres@postgres.berkeley.edu
help / color / mirror / Atom feedFrom: alfredo@bush.cs.tamu.edu
To: postgres@postgres.Berkeley.EDU
Subject: memory error while using portals
Date: Fri, 22 Apr 94 21:49:40 CDT
Message-ID: <9404230249.AA18473@ bush.cs.tamu.edu> (raw)
postgresers,
I defined a simple C function using PQlib which checks whether
an object with a given oid exists. I call this function within a
transaction from other PQlib-based programs and it's been workin ok.
However, one program is giving me trouble exactly when this
simple function is called. The error I get is:
signal SEGV (no mapping at the fault address) in pbuf_freeTuples at 0x9a90
pbuf_freeTuples+0x50: ld [%i3], %o3
and a stack trace gives:
(dbxtool) where
pbuf_freeTuples() at 0x9a90
pbuf_freeGroup() at 0x9b40
pbuf_freePortal() at 0x9b6c
pbuf_setup() at 0x9c2c
dump_data() at 0xadc8
process_portal() at 0x5744
PQexec() at 0x657c
OM_ObjectExists(id = 42272), line 41 in "OM/src/OM_ObjectExists.c"
Within the caller program, the OM_ObjectExists function is repeatedly called
with different oid and works well until this happens (5th time).
Has anyone had any similar problem or can suggest a reason for this?
I am including the C function below.
Thanks for any help,
-Alfredo Sanchez
alfredo@bush.cs.tamu.edu
-----------------------------
int OM_ObjectExists(id)
unsigned long id; /* ID OF OBJECT TO LOOK FOR*/
{
char postquery[512]; /* STORES QUERIES SUBMITTED TO POSTGRES */
PortalBuffer *portalbuff; /* POINTS TO DATA RETRIEVED FROM DB */
char *result; /* STORES RESULTS FROM PG OPERATIONS */
int exists; /* USED TO STORE THE FUNCTION'S RESULT */
/* CHECK WHETHER OBJECT EXISTS */
sprintf(postquery, "retrieve portal p1 (Objects.oid) \
where Objects.id = \"%ld\"",id);
result = PQexec(postquery);
if (result[0] != 'C') {
HRLTdiag_Emit (HRLTdiag_Fatal, "Can't access Objects\n");
return(PG_FAILED);
}
result = PQexec("fetch all in p1");
if (result[0] != 'P') {
HRLTdiag_Emit (HRLTdiag_Fatal, "Can't check whther Object exists\n");
return(PG_FAILED);
}
portalbuff = PQparray("p1");
if (PQntuples(portalbuff) == 0)
exists = FALSE;
else
exists = TRUE;
/* CLOSE PORTAL */
result = PQexec("close p1");
if (result[0] != 'C') {
HRLTdiag_Emit (HRLTdiag_Fatal, "Can't close portal p1\n");
return(PG_FAILED);
}
return(exists);
}
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: postgres@postgres.berkeley.edu
Cc: alfredo@bush.cs.tamu.edu
Subject: Re: memory error while using portals
In-Reply-To: <9404230249.AA18473@ bush.cs.tamu.edu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox