Re: LOG: unexpected EOF within message length word

From: "Mavinakuli, Prasanna (STSD)" <prasanna(dot)b-m(at)hp(dot)com>
To: "Michael Fuhr" <mike(at)fuhr(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: LOG: unexpected EOF within message length word
Date: 2005-09-03 06:24:20
Message-ID: E84C4F56CA80174D8834825116CF247F011715DD@bgeexc05.asiapacific.cpqcorp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)fuhr(dot)org]
Sent: Saturday, September 03, 2005 11:08 AM
To: Mavinakuli, Prasanna (STSD)
Cc: pgsql-general(at)postgresql(dot)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

Browse pgsql-general by date

  From Date Subject
Next Message Poul Jensen 2005-09-03 08:59:54 Query questions
Previous Message Mavinakuli, Prasanna (STSD) 2005-09-03 06:01:19 Re: LOG: unexpected EOF within message length word