Re: Memory Access Violation While Using PQexec - Mailing list pgsql-general

From Craig Ringer
Subject Re: Memory Access Violation While Using PQexec
Date
Msg-id 4B4FB4EE.9070408@postnewspapers.com.au
Whole thread Raw
In response to Memory Access Violation While Using PQexec  (Yan Cheng Cheok <yccheok@yahoo.com>)
List pgsql-general
On 14/01/2010 4:49 PM, Yan Cheng Cheok wrote:
> I encounter case when I call a stored procedure for 299166 th times (intensive, i put a non-stop while true loop to
callstored procedure) 
>
> , the following exception will be thrown from PQexec. I am rather sure the exception are from PQexec, as there is a
justbefore cout and just after cout wrap around PQexec. 
>
>
>          std::cout<<  "Start PQexec "<<  sql<<  std::endl;
>          PGresult *res = PQexec(connection, sql.c_str());
>          std::cout<<  "End PQexec "<<  sql<<  std::endl;
>          const bool status = (PQresultStatus(res) == PGRES_TUPLES_OK);
>          PQclear(res);
>
> "End PQexec..." is not being printed.
> The call stack is :
>
>       libpq.dll!10017ea5()
>       [Frames below may be incorrect and/or missing, no symbols loaded for libpq.dll]

You need to add c:\Program Files\PostgreSQL\8.4\symbols to your debug
symbol path. See:

http://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Windows

That will also help Visual Studio break accurately, which it probably
isn't doing right now. There's a fair chance that where you broke in the
debugger has nothing to do with what is actually wrong.

> Any suggestion?

I'm too clueless to give you a useful answer here, beyond telling you to
set your debug environment up properly and try again.

If you can extract this into a standalone test case (a single compilable
C or C++ program, plus a .sql file) that'd be rather handy, though. It
also means that if it's a bug in your code - say, you're corrupting the
heap - then building a test case will help you track that down by
elimination.

--
Craig Ringer

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Split pg_dump dump into files and then combine it back
Next
From: Ravi Chemudugunta
Date:
Subject: DELETE Weirdness