Thread: Problems with C Language Functions after upgrade to 7.3.2
Last friday we did an upgrade from postgres 7.1.3 to 7.3.2. In the database there are triggers written in C, which start external programs using the system calls fork+exec. In 7.1.3 triggers worked fine. With 7.3.2 triggers work in most cases but in some cases execution fails at fork or exec. Any ideas? Stefan PS: We recompiled the shared libraries for 7.3.2. OS is Redhat Linux 7.1 -- ----------------------------- Dr. Stefan Holzheu Tel.: 0921/55-5720 Fax.: 0921/55-5799 BITOeK Wiss. Sekretariat Universitaet Bayreuth D-95440 Bayreuth -----------------------------
Stefan Holzheu <stefan.holzheu@bitoek.uni-bayreuth.de> writes: > Last friday we did an upgrade from postgres 7.1.3 to 7.3.2. In the > database there are triggers written in C, which start external programs > using the system calls fork+exec. > In 7.1.3 triggers worked fine. With 7.3.2 triggers work in most cases > but in some cases execution fails at fork or exec. Fails how? What's the error code exactly? The notion of running external programs from a trigger strikes me as a really bad idea in any case. (What happens if the transaction gets rolled back later? You won't be able to undo whatever the external program did.) But I don't know any reason why it would work less well now than in 7.1. regards, tom lane
Thank, for the fast response >>In 7.1.3 triggers worked fine. With 7.3.2 triggers work in most cases >>but in some cases execution fails at fork or exec. > > Fails how? What's the error code exactly? fork: errno 2 /* No such file or directory */ exec: errno 11 /* Try again */ > > The notion of running external programs from a trigger strikes me as a > really bad idea in any case. (What happens if the transaction gets > rolled back later? You won't be able to undo whatever the external > program did.) That's true, and we are aware of this problem. But it is still better to have the database to do this than a web server. Would you prefere to use a normal function? Thanks in advance Stefan > But I don't know any reason why it would work less well > now than in 7.1. > > regards, tom lane > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > -- ----------------------------- Dr. Stefan Holzheu Tel.: 0921/55-5720 Fax.: 0921/55-5799 BITOeK Wiss. Sekretariat Universitaet Bayreuth D-95440 Bayreuth -----------------------------
Stefan Holzheu <stefan.holzheu@bitoek.uni-bayreuth.de> writes: > In 7.1.3 triggers worked fine. With 7.3.2 triggers work in most cases > but in some cases execution fails at fork or exec. >> Fails how? What's the error code exactly? > fork: errno 2 /* No such file or directory */ > exec: errno 11 /* Try again */ Hmm. You mean the other way round, I assume, because ENOENT surely makes no sense for fork(). System resource exhaustion problems, maybe? EAGAIN for fork() strongly suggests that. Perhaps you are running into a ulimit-like limit, such as max processes per user? Not sure about ENOENT --- are you giving an absolute path to locate the program to execute? regards, tom lane