On Tuesday 14 October 2003 20:50, you wrote: > Igor Shevchenko <[EMAIL PROTECTED]> writes: > > The problem is repeatable when I run my program, especially if the > > postgresql server and the sserv are on the same server, and the debugging > > is off. Please let me know if you need more details, I'll try to narrow > > the conditions to make a simple reproductible sequence of commands. > > I think we're going to need a test case to make any progress on this > one.
Here's a test case. 1. in t2.cc, replace table name "a" in "select * from a" with any other table which has lots of data. In my setup, the table 'a' is : Table "public.a" Column | Type | Modifiers --------+-------------------+----------- txt | character varying | It has ~50k of rows with the same value 'hello'. 2. compile t2.cc 3. run "while true; do echo "notify new_event" | psql; done" in one shell 4. run t2 in another shell The t2's backend fails before the query is finished and the following is printed in the postgresql's log: WARNING: CommitTransaction and not in in-progress state TRAP: FailedAssertion("!(TopTransactionContext != ((void *)0))", File: "xact. c", Line: 660) LOG: server process (PID 10622) was terminated by signal 6 LOG: terminating any other active server processes > > regards, tom lane -- Best regards, Igor Shevchenko
#include <stdio.h> #include <libpq-fe.h> #include <iostream> using namespace std; void exit_nicely ( PGconn* conn ) { PQfinish(conn); exit(1); } #define PGHOST NULL main() { // connect PGconn* conn = PQsetdbLogin ( PGHOST, // host NULL, // port NULL, // options NULL, // pgtty NULL, // dbname NULL, // login NULL // pwd ); if ( PQstatus(conn) == CONNECTION_BAD ) { cerr << "connect failed: " << PQerrorMessage(conn) << endl; exit_nicely(conn); } PGresult* res; if ( !(res = PQexec ( conn, "listen new_event" )) ) { cerr << "PQexec error: " << PQerrorMessage(conn) << endl; exit_nicely(conn); } PQclear ( res ); if ( 0 != PQsetnonblocking ( conn, 1 ) ) { cerr << "pqsetnonblocking error: " << PQerrorMessage ( conn ) << endl; exit_nicely(conn); } if ( !PQexecParams ( conn, "select * from a", 0, 0, 0, 0, 0, 1 ) ) { cerr << "pssendquery error: " << PQerrorMessage ( conn ) << endl; exit_nicely(conn); } while ( true ) { if ( 0 == PQconsumeInput ( conn ) ) { cerr << "PQconsumeInput error: " << PQerrorMessage(conn) << endl; return 0; } // check notifications PGnotify* n; while ( (n = PQnotifies ( conn )) ) { cerr << "got notification \"" << n->relname << "\"\n"; PQfreemem ( n ); } // check if the result is ready if ( !PQisBusy ( conn ) ) { while ( (res = PQgetResult(conn)) ) { cerr << "got result\n"; PQclear ( res ); } //break; } } // close connection PQfinish(conn); return 0; }
---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])