Thread: libpq++ update
============================================================================ POSTGRESQL BUG REPORT TEMPLATE ============================================================================ Your name : Tom Vijlbrief Your email address : tom.vijlbrief@knoware.nl System Configuration --------------------- Architecture (example: Intel Pentium) : Intel PII Operating System (example: Linux 2.0.26 ELF) : Linux 2.3.51 PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-6.5.3 Compiler used (example: gcc 2.8.0) : egcs-2.91.66 Please enter a FULL description of your problem: libpq++ leaks file descriptors and memory. The constructor of PgConnection leaks a file everytime it is called. Also DEBUG is on by default. In addition the header file libpq++.H is insane. It contains outdated copies of the header files (pglobject.h and the others). The libpq++.H declares a smaller PgLargeObject (without class member variables) then the PgLargeObject in pglobject.h. This is the reason that examples/testlo crashes ! I fixed the header classes and memory/file leakage. I also added header file PostgresDatabase.h which contains a new implementation with exception handling, cursors and transactions. Look at examples/testexcep.cc for the usage. The C++ interface is still compatible with the old version. Please describe a way to repeat the problem. Please try to provide a concise reproducible example, if at all possible: ---------------------------------------------------------------------- Running the next program, it crashes after approx. 1000 iterations (depending on configuration of OS) #include <libpq++.H> #include <iostream> int main() { for (int i= 0; i < 10000; i++) { cerr << i << endl; PgConnection(""); } } Running examples/testlo crashes with a damaged stack. If you know how this problem might be fixed, list the solution below: --------------------------------------------------------------------- change 'FILE * debug' from a local var to a static var in pgconnection.cc. I added a tar containing a new version of the src/interfaces/libpq++ directory because many files (source, headers, README, TODO, CHANGES) are changed.
Attachment
This looks like good stuff. Can someone suggest what I should do with it, seeing how close we are to 7.0 final? Maybe I should create a diff now, and apply it to 7.0.1. > ============================================================================ > POSTGRESQL BUG REPORT TEMPLATE > ============================================================================ > > > Your name : Tom Vijlbrief > Your email address : tom.vijlbrief@knoware.nl > > > System Configuration > --------------------- > Architecture (example: Intel Pentium) : Intel PII > > Operating System (example: Linux 2.0.26 ELF) : Linux 2.3.51 > > PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-6.5.3 > > Compiler used (example: gcc 2.8.0) : egcs-2.91.66 > > > Please enter a FULL description of your problem: > > libpq++ leaks file descriptors and memory. > > The constructor of PgConnection leaks a file everytime it is called. > Also DEBUG is on by default. > > In addition the header file libpq++.H is insane. It contains > outdated copies of the header files (pglobject.h and the others). > > The libpq++.H declares a smaller PgLargeObject (without class member > variables) then the PgLargeObject in pglobject.h. > This is the reason that examples/testlo crashes ! > > I fixed the header classes and memory/file leakage. I also added > header file PostgresDatabase.h which contains a new implementation > with exception handling, cursors and transactions. Look at > examples/testexcep.cc for the usage. The C++ interface is still > compatible with the old version. > > > Please describe a way to repeat the problem. Please try to provide a > concise reproducible example, if at all possible: > ---------------------------------------------------------------------- > Running the next program, it crashes after approx. 1000 iterations > (depending on configuration of OS) > > > #include <libpq++.H> > > #include <iostream> > > int main() > { > for (int i= 0; i < 10000; i++) { > cerr << i << endl; > PgConnection(""); > } > } > > > Running examples/testlo crashes with a damaged stack. > > > If you know how this problem might be fixed, list the solution below: > --------------------------------------------------------------------- > > change 'FILE * debug' from a local var to a static var in > pgconnection.cc. > > I added a tar containing a new version of the src/interfaces/libpq++ > directory > because many files (source, headers, README, TODO, CHANGES) are > changed. [Attachment, skipping...] -- Bruce Momjian | http://www.op.net/~candle pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Tom Vijlbrief, Tom Lane added some of your patches to 7.0. Do you have anything new for 7.1? I know you were still working on it when we entered beta. > ============================================================================ > POSTGRESQL BUG REPORT TEMPLATE > ============================================================================ > > > Your name : Tom Vijlbrief > Your email address : tom.vijlbrief@knoware.nl > > > System Configuration > --------------------- > Architecture (example: Intel Pentium) : Intel PII > > Operating System (example: Linux 2.0.26 ELF) : Linux 2.3.51 > > PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-6.5.3 > > Compiler used (example: gcc 2.8.0) : egcs-2.91.66 > > > Please enter a FULL description of your problem: > > libpq++ leaks file descriptors and memory. > > The constructor of PgConnection leaks a file everytime it is called. > Also DEBUG is on by default. > > In addition the header file libpq++.H is insane. It contains > outdated copies of the header files (pglobject.h and the others). > > The libpq++.H declares a smaller PgLargeObject (without class member > variables) then the PgLargeObject in pglobject.h. > This is the reason that examples/testlo crashes ! > > I fixed the header classes and memory/file leakage. I also added > header file PostgresDatabase.h which contains a new implementation > with exception handling, cursors and transactions. Look at > examples/testexcep.cc for the usage. The C++ interface is still > compatible with the old version. > > > Please describe a way to repeat the problem. Please try to provide a > concise reproducible example, if at all possible: > ---------------------------------------------------------------------- > Running the next program, it crashes after approx. 1000 iterations > (depending on configuration of OS) > > > #include <libpq++.H> > > #include <iostream> > > int main() > { > for (int i= 0; i < 10000; i++) { > cerr << i << endl; > PgConnection(""); > } > } > > > Running examples/testlo crashes with a damaged stack. > > > If you know how this problem might be fixed, list the solution below: > --------------------------------------------------------------------- > > change 'FILE * debug' from a local var to a static var in > pgconnection.cc. > > I added a tar containing a new version of the src/interfaces/libpq++ > directory > because many files (source, headers, README, TODO, CHANGES) are > changed. [ Attachment, skipping... ] -- Bruce Momjian | http://www.op.net/~candle pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026