Re: debugging the server[ module causes server cash]

From: "mike(at)trausch(dot)us" <mike(at)trausch(dot)us>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: debugging the server[ module causes server cash]
Date: 2012-02-04 14:33:12
Message-ID: 4F2D41A8.1020408@trausch.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/04/2012 02:37 AM, Dave Potts wrote:
> I have just inherited a private C module that lives in the context of
> the server with little or no documentation.
>
> It crashes taking the database down, is there any advice on how to
> debug this type of beast ?
>
> This is not a problem with the postgres server but user module.

While I cannot offer advice specific to PostgreSQL (and someone here
might be better equipped to do that if there is anything that must be
done special for PostgreSQL), I can say that what you need to do is try
to use the debugger to catch the crash.

If you can do that, then you can get a backtrace and start working from
there.

If you are not comfortable with the debugger, you can instead put
debugging statements in your custom module. This way, you can trace
where it is crashing. If you are running on a system that has glibc, it
provides some helpful functions where you can display backtraces at
arbitrary points in your code:

http://www.linuxjournal.com/article/6391
http://www.gnu.org/software/libc/manual/html_node/Backtraces.html

In any case, good luck!

--- Mike

--
A man who reasons deliberately, manages it better after studying Logic
than he could before, if he is sincere about it and has common sense.
--- Carveth Read, “Logic”

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2012-02-04 16:28:50 Re: Why this regexp matches?!
Previous Message hubert depesz lubaczewski 2012-02-04 08:58:39 Re: Why this regexp matches?!