Operating System - HP-UX
1752607 Members
4761 Online
108788 Solutions
New Discussion

libpq for hpws apache32 thread safe?

 
Stefan Beelen
Occasional Contributor

libpq for hpws apache32 thread safe?

We installed on HPUX 11.23 IPF machines following software:
HPWS Apache32 B.2.0.52.00
ixPostgresql A.03.00-7.4.2.001

The 'configure' options explained in the README.hp of the postgresql product indicates that the program was compiled without the --enable-thread-safety.
This means that the resulting libpq library is not thread safe. Yet it is used by the Apache32 PHP module when interfacing to a postgres database. But this apache is using
threads. Am I missing something here, or
did the HPUX engineers porting the postgresql
forget to think of these thread issues?

We do have a problem with this combination of
software products.
Sometimes PHP webpage accessing the database with pg_connect() and pg_query() fails with
following error:
Warning: pg_exec(): Query failed: could not receive data from server: Invalid argument

After refreshing the webpage (in the browser) several times, eventually we get a valid output. It appears to depend on the size of the result of the database request.
1 REPLY 1
Stefan Beelen
Occasional Contributor

Re: libpq for hpws apache32 thread safe?

We found a workaround for our problem.
Instead of using the synchronous pg_exec() (or pg_query()) we now use the asynchronous calls:

$conn = pg_connect(".....");
pg_send_query($conn, "SELECT ....");
while (pg_connection_busy($conn))
{
usleep(100000);
}
$res = pg_get_result($conn);


This seems to work in all tested cases.