Thread: LOG: unexpected EOF within message length word

LOG: unexpected EOF within message length word

From
"Mavinakuli, Prasanna (STSD)"
Date:
Hi,

When I try to insert the data of size 40764 bytes(data type bytea) the
call PQexecparams won't return and when I kill that one it gives
The log:"LOG:  unexpected EOF within message length word"
Or "Log:Incomplete message transfer from client".

If I try to insert data of size 40760 bytes (data type:bytea)
Then it will insert the data succesfully.


Thx in advance,
Prasanna.

Re: LOG: unexpected EOF within message length word

From
Michael Fuhr
Date:
On Fri, Sep 02, 2005 at 09:30:31AM +0530, Mavinakuli, Prasanna (STSD) wrote:
> When I try to insert the data of size 40764 bytes(data type bytea) the
> call PQexecparams won't return and when I kill that one it gives
> The log:"LOG:  unexpected EOF within message length word"
> Or "Log:Incomplete message transfer from client".
>
> If I try to insert data of size 40760 bytes (data type:bytea)
> Then it will insert the data succesfully.

Works fine here -- could you post a simple but complete program
that demonstrates the problem?  Have you used a debugger or process
trace to see what the program is doing?

--
Michael Fuhr

Re: LOG: unexpected EOF within message length word

From
Tom Lane
Date:
"Mavinakuli, Prasanna (STSD)" <prasanna.b-m@hp.com> writes:
> When I try to insert the data of size 40764 bytes(data type bytea) the
> call PQexecparams won't return and when I kill that one it gives
> The log:"LOG:  unexpected EOF within message length word"
> Or "Log:Incomplete message transfer from client".

> If I try to insert data of size 40760 bytes (data type:bytea)
> Then it will insert the data succesfully.

I think the odds are about 100:1 that this is a bug in your own code.
However, if you want to send in a self-contained test case, we'll be
glad to take a look at it.

            regards, tom lane

Re: LOG: unexpected EOF within message length word

From
Michael Fuhr
Date:
On Sat, Sep 03, 2005 at 09:29:20AM +0530, Mavinakuli, Prasanna (STSD) wrote:
> here is the sample code which works fine and prints column
> lengths in HP-UX PA machines and breaks in HP-UX IA machines.

The code you posted works for me with PostgreSQL 8.0.3 on FreeBSD
4.11-STABLE/i386 and Solaris 9/sparc.  I don't know if there are
any issues with HP-UX IA; is there anything else different about
the two environments?  What versions of PostgreSQL are you using?

Aside from not being a complete program, the code you posted doesn't
quite match the problem description you gave initially: you said
you could send 40760 bytes, but that sending 40764 bytes caused the
connection to hang.  Is that an accurate description?  The code you
posted sends 3000000 bytes and several additional columns that might
not be relevant to the problem.

> I tried tusc (I sent that o/p in previuos mail.

I haven't seen that -- did you send it to the mailing list?

> Client opens a socket and starts to write.but after some send receive it
> goes to SLEEPING state)

How much data is written before this happens?  Are you using a local
(Unix socket) connection or a TCP connection?  If the latter, have
you run a sniffer on the connection to see if it shows anything
unusual (e.g., a closed window)?

--
Michael Fuhr

Re: LOG: unexpected EOF within message length word

From
"Mavinakuli, Prasanna (STSD)"
Date:
Thx for u'r response

here is the sample code which works fine and prints column
lengths in HP-UX PA machines and breaks in HP-UX IA machines.
I tried tusc (I sent that o/p in previuos mail.
Client opens a socket and starts to write.but after some send receive it
goes to SLEEPING state)


 void FMconnection::insertlargedata()
        {

         const char * command="insert into
rawlog(event_type,event_source,event_rawdata,event_version) values
($1,$2,$3,$4);";
         int nParams = 4;
         const Oid paramTypes[] = {NULL,NULL,17,NULL};
         int  paramFormats[] = {0,0,1,0};
         int resultFormat = 0;
         const int paramLengths[]={100,200,3000000,10};
        char *a = new char[3000000];

         const char* paramValues[]={"cpu.event","cpu",a,"1"};


res1=PQexecParams(conn,command,nParams,paramTypes,paramValues,paramLengt
hs,paramFormats,resultFormat);
         res1=PQexec(conn,"select * from rawlog");
         for(int kk=0;kk<PQntuples(res1);kk++)
         cout<<"the size  of binary data is
"<<PQgetlength(res1,kk,3)<<endl;

         delete a;

         }

Hope to see u'r mail soon,
Thx,
Prasanna.


-----Original Message-----
From: Michael Fuhr [mailto:mike@fuhr.org]
Sent: Friday, September 02, 2005 7:45 PM
To: Mavinakuli, Prasanna (STSD)
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] LOG: unexpected EOF within message length word

On Fri, Sep 02, 2005 at 09:30:31AM +0530, Mavinakuli, Prasanna (STSD)
wrote:
> When I try to insert the data of size 40764 bytes(data type bytea) the

> call PQexecparams won't return and when I kill that one it gives The
> log:"LOG:  unexpected EOF within message length word"
> Or "Log:Incomplete message transfer from client".
>
> If I try to insert data of size 40760 bytes (data type:bytea) Then it
> will insert the data succesfully.

Works fine here -- could you post a simple but complete program that
demonstrates the problem?  Have you used a debugger or process trace to
see what the program is doing?

--
Michael Fuhr

Re: LOG: unexpected EOF within message length word

From
"Mavinakuli, Prasanna (STSD)"
Date:
1)
I am using postgres 7.4 version.

2)I have sent tusc o/p along with first mail.however I will attch it
once again.

3)the following code works fine in HP-UX PA machines.but not in HP-UX IA
machines.
  I meant the maxiumum data that we can insert into IA machines
  is 40760.if we make it to 40764 then the code breaks.
  Here also size of array matters.and all code is same.
  It just contain some additional info of size 25   charecters/column
which I feel not relevant to problem.

4)I have changed default setting and made it as TCP
  still problem persists.
  Cud u please eloborate more on this topic(using TCP vs Unix Socket)


Thx ,
Waiting for u'r reply,
Prasanna.

Tusc o/pafter doing new *****write(1, "a f t e r   d o i n g   n e w
".., 21)
.....................................................................
= 21

write(1, "\n", 1)
........................................................................
.............................. = 1
after assigning values******write(1, "a f t e r   a s s i g n i n g
".., 28) ...............................................................
...... = 28

write(1, "\n", 1)
........................................................................
.............................. = 1
after creating buffer*****write(1, "a f t e r   c r e a t i n g   b "..,
26) .................................................................
.... = 26

write(1, "\n", 1)
........................................................................
.............................. = 1
after creating LogEntry r*****write(1, "a f t e r   c r e a t i n g   L
".., 30) .............................................................
........ = 30

write(1, "\n", 1)
........................................................................
.............................. = 1
getuid()
........................................................................
....................................... = 0 (0)
stat("/etc/krb5.conf", 0x9ffffffffffef720)
........................................................................
..... ERR#2 ENOENT
stat("/usr/etc/krb5.conf", 0x9ffffffffffef720)
........................................................................
. ERR#2 ENOENT
getuid()
........................................................................
....................................... = 0 (0)
open("/var/spool/pwgr/status", O_RDONLY|0x800, 0)
...................................................................... =
3
mmap(NULL, 532, PROT_READ, MAP_SHARED|MAP_VARIABLE|MAP_FILE|MAP_ADDR32,
3, 0) .......................................... = 0xc1654000
close(3)
........................................................................
....................................... = 0
socket(AF_UNIX, SOCK_DGRAM, 0)
........................................................................
................. = 3
getpid()
........................................................................
....................................... = 12696217 (12696215)
unlink("/var/spool/sockets/pwgr/client12696217")
.......................................................................
ERR#2 ENOENT
bind(3, 0x9fffffffef77dba0, 41)
........................................................................
................ = 0
fcntl(3, F_SETFD, 1)
........................................................................
........................... = 0
time(NULL)
........................................................................
..................................... = 1125718784
stat("/etc/default/lugname", 0x9ffffffffffed3d0)
.......................................................................
ERR#2 ENOENT
poll(0x9ffffffffffee278, 1, 0)
........................................................................
................. = 1
sendto(3, "\0\0\00 \0\0\001\0\0\0\0\0\0\001".., 48, 0,
0x9fffffffef77dc00, 0x19) ....................................... = 48
poll(0x9ffffffffffee278, 1, 1000)
........................................................................
.............. = 1
recvfrom(3, "\0\0\03 \0\0\0\0\0\0\0\0\0\0\0# ".., 2064, 0,
0x9ffffffffffee320, 0x9ffffffffffee274) ..................... = 51
socket(AF_UNIX, SOCK_STREAM, 0)
........................................................................
................ = 4
fcntl(4, F_SETFL, 65536)
........................................................................
....................... = 0
connect(4, 0x6000000000033670, 94)
........................................................................
............. = 0
getsockopt(4, SOL_SOCKET, SO_ERROR, 0x9ffffffffffeff84,
0x9ffffffffffeff88) ............................................ = 0
getsockname(4, 0x600000000007a888, 0x600000000007a988)
................................................................. = 0
poll(0x9ffffffffffeff50, 1, -1)
........................................................................
................ = 1
sigsetreturn(NULL, 0x6211988, 48640)
........................................................................
........... = 0
sigaction(SIGPIPE, 0x9ffffffffffefce0, 0x9ffffffffffefd10)
............................................................. = 0
send(4, "\0\0\0! \003\0\0u s e r \0S F M ".., 33, 0)
................................................................... = 33
sigaction(SIGPIPE, 0x9ffffffffffefce0, 0x9ffffffffffefd10)
............................................................. = 0
poll(0x9ffffffffffeff50, 1, -1)
........................................................................
................ = 1
recv(4, "R \0\0\0\b\0\0\0\0S \0\0\01ec l ".., 16384, 0)
................................................................ = 161
sigaction(SIGPIPE, 0x9fffffffffff01b0, 0x9fffffffffff01e0)
............................................................. = 0
send(4, "Q \0\0\0\nB E G I N \0", 11, 0)
........................................................................
....... = 11
sigaction(SIGPIPE, 0x9fffffffffff01b0, 0x9fffffffffff01e0)
............................................................. = 0
poll(0x9fffffffffff0300, 1, -1)
........................................................................
................ = 1
recv(4, "C \0\0\0\nB E G I N \0Z \0\0\005".., 16384, 0)
................................................................ = 17
### Buffer size ###write(1, "# # #   B u f f e r   s i z e   ".., 19)
..................................................................... =
19
60760write(1, "6 0 7 6 0 ", 5)
........................................................................
...................... = 5

write(1, "\n", 1)
........................................................................
.............................. = 1
entered****write(1, "e n t e r e d * * * * ", 11)
........................................................................
......... = 11

write(1, "\n", 1)
........................................................................
.............................. = 1
brk(0x6000000000100000)
........................................................................
........................ = 0
before calling pqexec dummy ******write(1, "b e f o r e   c a l l i n g
p ".., 34) .........................................................
............ = 34

write(1, "\n", 1)
........................................................................
.............................. = 1
brk(0x6000000000120000)
........................................................................
........................ = 0
sigaction(SIGPIPE, 0x9fffffffffff0080, 0x9fffffffffff00b0)
............................................................. = 0
send(4, "P \0\0\0u \0i n s e r t   i n t ".., 98304, 0)
................................................................ = 32768
sigaction(SIGPIPE, 0x9fffffffffff0080, 0x9fffffffffff00b0)
............................................................. = 0
recv(4, 0x600000000007acc0, 16384, 0)
........................................................................
.......... ERR#11 EAGAIN
poll(0x9fffffffffff00d0, 1, -1)
........................................................................
................ = 1
sigaction(SIGPIPE, 0x9fffffffffff0080, 0x9fffffffffff00b0)
............................................................. = 0
send(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0".., 65536, 0)
................................................................ = 32768
sigaction(SIGPIPE, 0x9fffffffffff0080, 0x9fffffffffff00b0)
............................................................. = 0
recv(4, 0x600000000007acc0, 16384, 0)
........................................................................
.......... ERR#11 EAGAIN
poll(0x9fffffffffff00d0, 1, -1)
........................................................................
................ = 1
sigaction(SIGPIPE, 0x9fffffffffff0080, 0x9fffffffffff00b0)
............................................................. = 0
send(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0".., 32768, 0)
................................................................ = 32768
sigaction(SIGPIPE, 0x9fffffffffff0080, 0x9fffffffffff00b0)
............................................................. = 0
sigaction(SIGPIPE, 0x9fffffffffff0090, 0x9fffffffffff00c0)
............................................................. = 0
send(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0".., 1888, 0)
................................................................. = 1888
sigaction(SIGPIPE, 0x9fffffffffff0090, 0x9fffffffffff00c0)
............................................................. = 0
poll(0x9fffffffffff01f0, 1, -1)
........................................................................
................ = 1
recv(4, "1 \0\0\0042 \0\0\004n \0\0\004C ".., 16384, 0)
................................................................ = 41
before calling pqexec command******write(1, "b e f o r e   c a l l i n g
p ".., 35) ........................................................
............. = 35
insert into RAWLOG (event_type,event_source,event_rawdata,event_version)
values ($1,$2,$3,$4)write(1, "i n s e r t   i n t o   R A W L ".., 93
) .....................................................................
= 93
after inserting datawrite(1, "a f t e r   i n s e r t i n g   ".., 20)
..................................................................... =
 20

write(1, "\n", 1)
........................................................................
.............................. = 1

write(1, "\n", 1)
........................................................................
.............................. = 1

write(1, "\n", 1)
........................................................................
.............................. = 1
constructing result set objectwrite(1, "c o n s t r u c t i n g   r e s
".., 30) .............................................................
........ = 30
calling read data function****<<write(1, "c a l l i n g   r e a d   d a
t ".., 32) ...........................................................
.......... = 32

write(1, "\n", 1)
........................................................................
.............................. = 1
returning from *****<<write(1, "r e t u r n i n g   f r o m   * ".., 22)
.....................................................................
 = 22

write(1, "\n", 1)
........................................................................
.............................. = 1
sigaction(SIGPIPE, 0x9fffffffffff01c0, 0x9fffffffffff01f0)
............................................................. = 0
send(4, "Q \0\0\0& s e l e c t   m a x ( ".., 39, 0)
................................................................... = 39
sigaction(SIGPIPE, 0x9fffffffffff01c0, 0x9fffffffffff01f0)
............................................................. = 0
poll(0x9fffffffffff0310, 1, -1)
........................................................................
................ = 1
recv(4, "T \0\0\01c\001m a x \0\0\0\0\0\0".., 16384, 0)
................................................................ = 60
sigaction(SIGPIPE, 0x9fffffffffff01b0, 0x9fffffffffff01e0)
............................................................. = 0
send(4, "Q \0\0\0\vC O M M I T \0", 12, 0)
........................................................................
..... = 12
sigaction(SIGPIPE, 0x9fffffffffff01b0, 0x9fffffffffff01e0)
............................................................. = 0
poll(0x9fffffffffff0300, 1, -1)
........................................................................
................ = 1
recv(4, "C \0\0\0\vC O M M I T \0Z \0\0\0".., 16384, 0)
................................................................ = 18
brk(0x6000000000140000)
........................................................................
........................ = 0
size of additional buffer *****write(1, "s i z e   o f   a d d i t i o n
".., 31) ............................................................
......... = 31
0write(1, "0 ", 1)
........................................................................
.............................. = 1

write(1, "\n", 1)
........................................................................
.............................. = 1
entered****write(1, "e n t e r e d * * * * ", 11)
........................................................................
......... = 11

write(1, "\n", 1)
........................................................................
.............................. = 1
before calling pqexec dummy ******write(1, "b e f o r e   c a l l i n g
p ".., 34) .........................................................
............ = 34
write(1, "\n", 1)
........................................................................
.............................. = 1

write(1, "\n", 1)
........................................................................
.............................. = 1

write(1, "\n", 1)
........................................................................
.............................. = 1
constructing result set objectwrite(1, "c o n s t r u c t i n g   r e s
".., 30) .............................................................
........ = 30
calling read data function****<<write(1, "c a l l i n g   r e a d   d a
t ".., 32) ...........................................................
.......... = 32

write(1, "\n", 1)
........................................................................
.............................. = 1
returning from *****<<write(1, "r e t u r n i n g   f r o m   * ".., 22)
.....................................................................
 = 22

write(1, "\n", 1)
........................................................................
.............................. = 1
sigaction(SIGPIPE, 0x9fffffffffff01c0, 0x9fffffffffff01f0)
............................................................. = 0
send(4, "Q \0\0\0& s e l e c t   m a x ( ".., 39, 0)
................................................................... = 39
sigaction(SIGPIPE, 0x9fffffffffff01c0, 0x9fffffffffff01f0)
............................................................. = 0
poll(0x9fffffffffff0310, 1, -1)
........................................................................
................ = 1
recv(4, "T \0\0\01c\001m a x \0\0\0\0\0\0".., 16384, 0)
................................................................ = 60
sigaction(SIGPIPE, 0x9fffffffffff01b0, 0x9fffffffffff01e0)
............................................................. = 0
send(4, "Q \0\0\0\vC O M M I T \0", 12, 0)
........................................................................
..... = 12
sigaction(SIGPIPE, 0x9fffffffffff01b0, 0x9fffffffffff01e0)
............................................................. = 0
poll(0x9fffffffffff0300, 1, -1)
........................................................................
................ = 1
recv(4, "C \0\0\0\vC O M M I T \0Z \0\0\0".., 16384, 0)
................................................................ = 18
brk(0x6000000000140000)
........................................................................
........................ = 0
size of additional buffer *****write(1, "s i z e   o f   a d d i t i o n
".., 31) ............................................................
......... = 31
0write(1, "0 ", 1)
........................................................................
.............................. = 1

write(1, "\n", 1)
........................................................................
.............................. = 1
entered****write(1, "e n t e r e d * * * * ", 11)
........................................................................
......... = 11

write(1, "\n", 1)
........................................................................
.............................. = 1
before calling pqexec dummy ******write(1, "b e f o r e   c a l l i n g
p ".., 34) .........................................................
............ = 34

write(1, "\n", 1)
........................................................................
.............................. = 1
sigaction(SIGPIPE, 0x9fffffffffff0080, 0x9fffffffffff00b0)
............................................................. = 0
send(4, "P \0\0\0u \0i n s e r t   i n t ".., 98304, 0)
................................................................ = 40960
sigaction(SIGPIPE, 0x9fffffffffff0080, 0x9fffffffffff00b0)
............................................................. = 0
recv(4, 0x600000000007acc0, 16384, 0)
........................................................................
.......... ERR#11 EAGAIN
poll(0x9fffffffffff00d0, 1, -1)
........................................................................
................ [sleeping]
ksleep(PTH_CONDVAR_OBJECT, 0x9fffffffef7de4b8, 0x6000000000059388, NULL)
............................................... [sleeping]


After it goes forever sleep*****.


Prasanna.


-----Original Message-----
From: Michael Fuhr [mailto:mike@fuhr.org]
Sent: Saturday, September 03, 2005 11:08 AM
To: Mavinakuli, Prasanna (STSD)
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] LOG: unexpected EOF within message length word

On Sat, Sep 03, 2005 at 09:29:20AM +0530, Mavinakuli, Prasanna (STSD)
wrote:
> here is the sample code which works fine and prints column lengths in
> HP-UX PA machines and breaks in HP-UX IA machines.

The code you posted works for me with PostgreSQL 8.0.3 on FreeBSD
4.11-STABLE/i386 and Solaris 9/sparc.  I don't know if there are any
issues with HP-UX IA; is there anything else different about the two
environments?  What versions of PostgreSQL are you using?

Aside from not being a complete program, the code you posted doesn't
quite match the problem description you gave initially: you said you
could send 40760 bytes, but that sending 40764 bytes caused the
connection to hang.  Is that an accurate description?  The code you
posted sends 3000000 bytes and several additional columns that might not
be relevant to the problem.

> I tried tusc (I sent that o/p in previuos mail.

I haven't seen that -- did you send it to the mailing list?

> Client opens a socket and starts to write.but after some send receive
> it goes to SLEEPING state)

How much data is written before this happens?  Are you using a local
(Unix socket) connection or a TCP connection?  If the latter, have you
run a sniffer on the connection to see if it shows anything unusual
(e.g., a closed window)?

--
Michael Fuhr

Re: LOG: unexpected EOF within message length word

From
"Mavinakuli, Prasanna (STSD)"
Date:
  here is the complete code:

If I change the event_rawdata size to 40764 then it wotks in HP-UX PA
but goes infinite waiting /sleeping
If I close it externally (say ctrl c)then postgres gives the
LOG:Incomlete message from client or unexpected EOF within message
length word

Prasanna.

#include <iostream.h>
#include "libpq-fe.h"
#include <string>
#include <stdlib.h>
class FMconnection
         {
             private:
                PGconn *conn;
                 PGresult *res,*res1;



             public:
                     void connect();
                     void   insertlargedata();
                   ~FMconnection();
};
void FMconnection::insertlargedata()
         {



         const char * command="insert into
rawlog(event_type,event_source,event_rawdata,event_version) values
($1,$2,$3,$4);";
         int nParams = 4;
         const Oid paramTypes[] = {NULL,NULL,17,NULL};
         int  paramFormats[] = {0,0,1,0};
         int resultFormat = 0;
         //const int paramLengths[]={100,200,3000000,10};
         //char *a = new char[3000000];

             const int paramLengths[]={100,200,40760,10);
             char *a = new char[40760];

         const char* paramValues[]={"cpu.event","cpu",a,"1"};


res1=PQexecParams(conn,command,nParams,paramTypes,paramValues,paramLengt
hs,paramFormats,resultFormat);
         res1=PQexec(conn,"select * from rawlog");
         for(int kk=0;kk<PQntuples(res1);kk++)
         cout<<"the size  of binary data is
"<<PQgetlength(res1,kk,3)<<endl;

         delete a;
         }

void FMconnection::connect()
       {


        char *dbn,*usn;
        char *error;


        cout<<"i am  connecting:"<<endl;
        conn=PQconnectdb("dbname = LOGDB  user = SFM");
        if(PQstatus(conn)==CONNECTION_OK)
        cout<<"connection is ready"<<endl;
        dbn=PQdb(conn);
       cout<<"the name of database     "<<dbn<<endl;


        usn=PQuser(conn);
        cout<<"the name of user         "<<usn<<endl;


        if(PQstatus(conn)==CONNECTION_BAD)
        cout<<"the connection is not hapened"<<endl;

        error=PQerrorMessage(conn);
        //cout<<"error"<<error<<endl;

        }
int main()
        {

            FMconnection on;
           on.connect();
            on.insertlargedata();
        return 1;

        }

From: Michael Fuhr [mailto:mike@fuhr.org]
Sent: Saturday, September 03, 2005 11:08 AM
To: Mavinakuli, Prasanna (STSD)
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] LOG: unexpected EOF within message length word

On Sat, Sep 03, 2005 at 09:29:20AM +0530, Mavinakuli, Prasanna (STSD)
wrote:
> here is the sample code which works fine and prints column lengths in
> HP-UX PA machines and breaks in HP-UX IA machines.

The code you posted works for me with PostgreSQL 8.0.3 on FreeBSD
4.11-STABLE/i386 and Solaris 9/sparc.  I don't know if there are any
issues with HP-UX IA; is there anything else different about the two
environments?  What versions of PostgreSQL are you using?

Aside from not being a complete program, the code you posted doesn't
quite match the problem description you gave initially: you said you
could send 40760 bytes, but that sending 40764 bytes caused the
connection to hang.  Is that an accurate description?  The code you
posted sends 3000000 bytes and several additional columns that might not
be relevant to the problem.

> I tried tusc (I sent that o/p in previuos mail.

I haven't seen that -- did you send it to the mailing list?

> Client opens a socket and starts to write.but after some send receive
> it goes to SLEEPING state)

How much data is written before this happens?  Are you using a local
(Unix socket) connection or a TCP connection?  If the latter, have you
run a sniffer on the connection to see if it shows anything unusual
(e.g., a closed window)?

--
Michael Fuhr

Re: LOG: unexpected EOF within message length word

From
Michael Fuhr
Date:
On Sat, Sep 03, 2005 at 11:31:19AM +0530, Mavinakuli, Prasanna (STSD) wrote:
> 1) I am using postgres 7.4 version.

Exactly which version?  What does "SELECT version()" show?  Did you
build PostgreSQL from source yourself, or did you install a pre-built
package?  Have you tried a newer version like 8.0.3 or 8.1beta1?

> 2)I have sent tusc o/p along with first mail.however I will attch it
> once again.

I don't see that output in any of your earlier messages, nor does
it show up in the copy in the list archives:

http://archives.postgresql.org/pgsql-general/2005-09/msg00077.php

No matter; I see the output in this message, although it doesn't
appear to be from the code you posted (the output shows text messages
that don't appear in the posted code).

> 3)the following code works fine in HP-UX PA machines.but not in HP-UX IA
> machines.
>   I meant the maxiumum data that we can insert into IA machines
>   is 40760.if we make it to 40764 then the code breaks.

How does the code behave in each of the following scenarios?

1. PA client connecting to PA server.
2. PA client connecting to IA server.
3. IA client connecting to PA server.
4. IA client connecting to IA server.

If anybody else is following this thread, have you experienced or
heard of problems with HP-UX IA before?

> 4)I have changed default setting and made it as TCP
>   still problem persists.
>   Cud u please eloborate more on this topic(using TCP vs Unix Socket)

The connection type might not matter; I was just wondering if you
had checked whether it did and if you had seen anything unusual in
a packet sniff.

> send(4, "P \0\0\0u \0i n s e r t   i n t ".., 98304, 0)
> ................................................................ = 40960

Here libpq attempts to write 98304 bytes but only 40960 bytes were
written; the pqSendSome() function within libpq will wait for the
socket to become writable before sending the rest.

> sigaction(SIGPIPE, 0x9fffffffffff0080, 0x9fffffffffff00b0)
> ............................................................. = 0
> recv(4, 0x600000000007acc0, 16384, 0)
> ........................................................................
> .......... ERR#11 EAGAIN
> poll(0x9fffffffffff00d0, 1, -1)
> ........................................................................
> ................ [sleeping]
> ksleep(PTH_CONDVAR_OBJECT, 0x9fffffffef7de4b8, 0x6000000000059388, NULL)
> ............................................... [sleeping]
>
> After it goes forever sleep*****.

Apparently the socket never becomes writable, or at least not for
as long as you waited.  How long did you wait before killing the
client?  What does a trace on the server process show when the
client is blocked?  What does a trace of the same client code on a
PA machine (one that works) show?

--
Michael Fuhr

Re: LOG: unexpected EOF within message length word

From
Tom Lane
Date:
Michael Fuhr <mike@fuhr.org> writes:
> On Sat, Sep 03, 2005 at 11:31:19AM +0530, Mavinakuli, Prasanna (STSD) wrote:
>> 1) I am using postgres 7.4 version.

> Exactly which version?

I'm wondering about the relevance of this pre-7.4-final bug fix:

2003-10-19 17:36  tgl

    * src/interfaces/libpq/: fe-exec.c, fe-misc.c: Adjust libpq to
    avoid deadlock when both client and server want to send data, and
    both have filled the transmission buffers.  One scenario where this
    can happen was illustrated here:
    http://archives.postgresql.org/pgsql-hackers/2003-04/msg00979.php

Supposing that a 7.4-beta libpq were in use, and for some reason the
server tries to send a large reply message before it's absorbed all
of the command, we could see a hangup like this.  It'd be useful to
see an strace of the server process in parallel with the client.

            regards, tom lane