issue with fastcgi program

Hello,

I am strugglign with the following fastcgi C++ program with access to a postgresql database through the SOCI library. All the components work individually properlyy but the combination does not. The program compiles fine but the Apapche 2.2 error log files contains:

[Mon May 18 10:09:23 2009] [error] [client IP.IP.IP.IP] FastCGI: comm with (dynamic) server some_path/dodo.cgi" aborted: (first read) idle timeout (30 sec)
[Mon May 18 10:09:23 2009] [error] [client IP.IP.IP.IP] FastCGI: incomplete headers (0 bytes) received from server "some_path/dodo.cgi"

main.cpp

      1 #include <fastcgi++/request.hpp>
      2 #include <fastcgi++/manager.hpp>
      3 #include <fstream>
      4 #include <boost/date_time/posix_time/posix_time.hpp>
      5 #include <boost/date_time/gregorian/gregorian.hpp>
      6 #include <boost/lexical_cast.hpp>
      7 #include <soci.h>
      8 #include <soci-postgresql.h>
      9 #include <libpq-fe.h>
     10
     11 class Main : public Fastcgipp::Request<char>
     12 {
     13 public:
     14   Main()
     15   {
     16   }
     17   virtual ~Main()
     18   {
     19   }
     20   bool response()
     21   {
     22     out << "Content-Type: text/html; charset=utf-8\r\n\r\n";
     23
     24     int count(0);
     25     //using namespace soci;
     26     //session sql(postgresql, "dbname=toff_db");
     27     //sql << "select count(*) from apps", into(count);
     28     //out << count << " rows.";
     29
     30     return true;
     31   }
     32 };
     33
     34 int main()
     35 {
     36   try
     37   {
     38     Fastcgipp::Manager<Main> fcgi;
     39     fcgi.handler();
     40   }
     41   catch(std::exception& e)
     42   {
     43   }
     44 }

Makefile

     2 CPP = g++
      3 CPP_FLAG = -Wall -W -O3
      4 TARGET_APP = "a.out"
      5
      6 BOOST = -I "/usr/local/include/boost-1_39/"
      7 SOCI = -I "/usr/local/include/soci/"
      8 PSQL = -I "/usr/local/pgsql/include/"
      9
     10 BOOST_THREAD_LIB = "/usr/local/lib/libboost_thread-gcc41-mt.so"
     11 FASTCGI_LIB = "/usr/local/lib/libfastcgipp.so"
     12 SOCI_LIB = "/usr/local/lib/libsoci_core.so"
     13 SOCI_DL_LIB = "/usr/lib/libdl.so"
     14 SOCI_PSQL_LIB = "/usr/local/lib/libsoci_postgresql.so"
     15 PSQL_LIB = "/usr/local/pgsql/lib/libpq.so"
     16
     17 $(TARGET_APP) : main.o
     18  $(CPP) -o $(TARGET_APP) $(FASTCGI_LIB) $(BOOST_THREAD_LIB) $(SOCI_LIB) $(SOCI_DL_LIB) $(SOCI_PSQL_LIB) $(PSQL_LIB)  main.o
     19
     20 main.o : main.cpp
     21  $(CPP) $(CPP_FLAG) $(BOOST) $(SOCI) $(PSQL) -c main.cpp

As you can see, the call to the postgresql database through soci has been commented out but the problem remains.

Could someone either solve the problem or maybe indicate me a way to investigate further to find a solution.

Thanks