On Wednesday 18 August 2004 10:34 am, Tom Lane wrote:
> Steve Crawford <scrawford@pinpointresearch.com> writes:
> > I've started seeing the following in my logs:
> > FATAL: invalid frontend message type 8
> >
> > I searched back over a month and there are 5 instances of this
> > error of which 4 are in the last 24 hours.
> >
> > I could not find this error defined. Any ideas of what it means,
> > it's severity, how to track the cause and cure?
>
> It looks to me like you've got an erroneous client that is sending
> bad data. The error is from tcop/postgres.c, when it doesn't
> recognize the first byte of what should be a message:
>
> default:
> /*
> * Otherwise we got garbage from the frontend. We
> treat this * as fatal because we have probably lost message
> boundary * sync, and there's no good way to recover.
> */
> ereport(FATAL,
> (errcode(ERRCODE_PROTOCOL_VIOLATION),
> errmsg("invalid frontend message type %d",
> qtype)));
>
> Can you determine exactly which client-side code is provoking the
> error?
I started recording all the raw network data and waited for the error
in the log. From this I have determined the machine and the likely
process. It is a telephony app written in C and using the pg
libraries. The piece in question opens a connection, verifies the
existence of the appropriate table (select from pg_ tables) and
inserts a record to that table.
All of the above works but following the terminating 0x00 of the final
insert there is about 12k of junk consisting of a mix of 0x08 and
0x80 characters ending with an 'X' (a normal connection is exactly
the same but there is no junk between the final 0x00 and 'X'). I've
only trapped one full instance so I don't know if the junk is always
the same.
Fortunately the data is actually inserted and the error occurs when
the app exits so the user-experience is not affected.
The client libraries are slightly older than the server but this
doesn't seem to be an issue as it's only happened 5-6 times in
tens-of-thousands of cases.
I'll look for causes in the code. If this symptom looks familar to
anyone, let me know.
Cheers,
Steve