Little remark.... To be honest, I don't see any advantage to init the PG connection during the instance creation. We could just suppress the call to initPgSQL and keep in this patch the test part in the BeginTransaction to init the connection if the handle is NULL.
Alain ecze wrote > Purpose of a patch for Stable Release 7.4.9 : > > diff -Nru ompgsql.c /new/ompgsql.c > --- ompgsql.c 2014-01-21 13:14:21.000000000 +0100 > +++ /new/ompgsql.c 2014-02-05 12:01:51.557026475 +0100 > @@ -262,8 +262,13 @@ > > BEGINbeginTransaction > CODESTARTbeginTransaction > +if ( pData->f_hpgsql == NULL ) { > + dbgprintf("ompgsql: connection need init\n"); > + CHKiRet(initPgSQL(pData, 0)); > +} > dbgprintf("ompgsql: beginTransaction\n"); > iRet = writePgSQL((uchar*) "begin", pData); /* TODO: make > user-configurable */ > +finalize_it: > ENDbeginTransaction > > > @@ -347,7 +352,17 @@ > errmsg.LogError(0, RS_RET_INVALID_PARAMS, "Trouble with > PgSQL connection properties. -PgSQL logging disabled"); > ABORT_FINALIZE(RS_RET_INVALID_PARAMS); > } else { > - CHKiRet(initPgSQL(pData, 0)); > + /* The next line is replaced because as explained in libpq > docs, > + * We can't keep a PGcon open if parent of a thread > forks. > + * So init close the connection to release all FD, > handles, etc... > + * > + * CHKiRet(initPgSQL(pData, 0)); > + */ > + if ( initPgSQL(pData, 0) == RS_RET_OK ) { > + dbgprintf("init ompgsql success now close it\n"); > + closePgSQL(pData); > + goto finalize_it; > + } > } > > CODE_STD_FINALIZERparseSelectorAct > > > Alain -- View this message in context: http://rsyslog-users.1305293.n2.nabble.com/rsyslog-7-4-9-ompgsql-libpq-threads-problem-tp7584204p7584226.html Sent from the rsyslog-users mailing list archive at Nabble.com. _______________________________________________ rsyslog mailing list http://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com/professional-services/ What's up with rsyslog? Follow https://twitter.com/rgerhards NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.