Re: segfaults
Gerhard Häring <[email protected]>
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Message-ID | <[email protected]> |
Craig Main wrote: > On Sat, 2003-04-19 at 11:37, Gerhard Häring wrote:> >>Craig Main wrote: >>>Hi all, >>> >>>Can anyone point me in the right direction for solving this? I am >>>running Gentoo. Running python test/PgSQLTestCases.py gives a segfault. >>>I have narrowed it down to the "from pyPgSQL import PgSQL" line. >>> >>>Any ideas? >> >>Does "from pyPgSQL import libpq" segfault already, too? > > yes > > This is what I get in the backtrace: > > (gdb) core core > Core was generated by `python PgSQLTestCases.py'. > Program terminated with signal 11, Segmentation fault. > #0 0x402a6637 in ?? () > #0 0x402a6637 in ?? () > #1 0x402aa7dc in ?? () > [...] Ouch. This isn't useful :-( To debug these kind of crashes we'll need to add diagnostic output to the C sources. Could you please apply the attached patch to libpqmodule.c (the patch is against pyPgSQL 2.3) and post the output of a "from pyPgSQL import libpq" ? Thanks, -- Gerhard
debug_patch.dif
(text/plain, 2.2 KB)
*** ../pypgsql.orig/libpqmodule.c Tue Apr 22 16:49:04 2003
--- libpqmodule.c Tue Apr 22 17:08:03 2003
***************
*** 48,53 ****
--- 48,54 ----
#include <string.h>
#include <stdlib.h>
+ #include <stdio.h>
#include <stddef.h>
#include <ctype.h>
#include <Python.h>
***************
*** 946,969 ****
--- 947,985 ----
{
PyObject *m, *d;
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
m = Py_InitModule("libpq", libpqMethods);
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
+
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
d = PyModule_GetDict(m);
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
/*-----------------------------------------------------------------------*/
PgConnection_Type.ob_type = &PyType_Type;
PgResult_Type.ob_type = &PyType_Type;
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
initpgconnection();
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
initpgresult();
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
initpglargeobject();
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
initpgnotify();
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
initpgboolean();
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
initpgint2();
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
#if defined(HAVE_LONG_LONG_SUPPORT)
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
initpgint8();
#endif
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
initpgversion();
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
/*-----------------------------------------------------------------------*/
***************
*** 1082,1087 ****
--- 1098,1104 ----
/*-----------------------------------------------------------------------*/
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
PqErr_Warning = PyErr_NewException("libpq.Warning",
PyExc_StandardError,
(PyObject *)NULL);
***************
*** 1141,1144 ****
--- 1158,1163 ----
if (PyErr_Occurred())
Py_FatalError("Can't initialize module libpq.\n");
+
+ printf("FILE: %s, LINE: %i\n", __FILE__, __LINE__);
}