Re: [BUGS] [HACKERS] Segmentation fault in libpq

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [BUGS] [HACKERS] Segmentation fault in libpq
Дата
Msg-id 14445.1498745576@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Segmentation fault in libpq  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: [BUGS] [HACKERS] Segmentation fault in libpq  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-hackers
Merlin Moncure <mmoncure@gmail.com> writes:
> On Thu, Jun 29, 2017 at 8:23 AM, Michal Novotny
> <michal.novotny@greycortex.com> wrote:
>> Could you please help me based on information provided above?

> You might want to run your code through some analysis tools (for
> example, valgrind).

Yeah, that's what I was about to suggest.  pqexpbuffer.c is pretty
small and paranoid code; it's really hard to see how it could have
crashed there unless something else corrupted its data structure.
While it's always possible that the "something else" was a wild
store from elsewhere in libpq, the lack of similar reports from
others and the fact that you don't sound to be doing anything very
exotic in terms of libpq requests both weigh against that theory.
If I had to bet given this much evidence, I'd bet on a wild store
from somewhere in your application having corrupted the
conn->errorMessage before PQexecParams was entered.  C is not a
language that does much to prevent that kind of bug for you.

valgrind is not a perfect tool for finding that kind of problem,
especially if you can't reproduce the crash reliably; but at least
valgrind is readily available and easy to use, so you might as
well start there and see if it finds anything.  If you have access
to any sort of static analysis tool (eg, Coverity), that might be
more likely to help.  Or you could fall back on manual code
auditing, if the program isn't very big.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: [HACKERS] Segmentation fault in libpq
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: [BUGS] [HACKERS] Segmentation fault in libpq