Re: Memory Access Violation While Using PQexec

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Yan Cheng Cheok <yccheok(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Memory Access Violation While Using PQexec
Date: 2010-01-15 00:21:02
Message-ID: 4B4FB4EE.9070408@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 call stored procedure)
>
> , the following exception will be thrown from PQexec. I am rather sure the exception are from PQexec, as there is a just before 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ravi Chemudugunta 2010-01-15 00:55:10 DELETE Weirdness
Previous Message Tom Lane 2010-01-15 00:18:14 Re: Split pg_dump dump into files and then combine it back