Thread: message type 0x50
Hi to all i received "message type 0x50 arrived from server while idle" ... RedHat Linux 9, postgres 7.3.4 the program is quite simple, a loop do UPDATE on a random entry on a table. Server is without autocommit. with setittimer and SIGALRM i do an explicit COMMIT every 10 seconds, update loop have a random delay from 0 to 500 msec using usleep(). I have problems using SIGALRM and libpq (libpqxx exactly), does libpq use select or other signal ??? trying to substiture usleep with a null for loop i obtain the massage "type 0x50..." some suggestion ??? P.S. on the table there is a trigger that execute an NOTIFY every update, but only one is received also if many updates happen between commits ... why ??? -- Alessandro GARDICH <gremlin@gremlin.it> gremlin.it
Alessandro GARDICH <gremlin@gremlin.it> writes: > the program is quite simple, a loop do UPDATE on a random entry on a > table. Server is without autocommit. > > with setittimer and SIGALRM i do an explicit COMMIT every 10 seconds, > update loop have a random delay from 0 to 500 msec using usleep(). I don't know the full answer to your question, but I don't think it's safe to call libpq functions from signals handlers. It's not really safe to do much of anything in signal handlers in fact. Even functions like printf() and malloc() aren't technically safe to call from signal handlers. What you should probably do is set a flag that you check upon completion of the usleep() or after every update, and handle the commit there. -- greg