Thread: debugging the server[ module causes server cash]
Hi 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.
On 02/03/12 11:37 PM, Dave Potts wrote: > Hi > > 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. well, the first thing I always want to ask is, 'did this used to work?' if so, what changed ? past that, well, its going to involve wanting to know what this module does, and how its crashing... its coredump and/or debug time. -- john r pierce N 37, W 122 santa cruz ca mid-left coast
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”
Attachment
Dave Potts <dave.potts@pinan.co.uk> writes: > 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 ? It isn't a lot different from debugging code that's part of the core server. You might start with the advice here: http://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD (there's a neighboring page for Windows, too) regards, tom lane