Jean-Francois Gauthier <jfgauthier@apsolab.com> writes:
> I have an application (multi thread) that send a lot of query on multiple
> connections to postgres executable backend using libpq client library. One
> connection per thread.
> Since the problem is very hard to reproduce, I cannot give you a sample sql
> file to reproduce it because it will require multiple sql files to run in
> parallel.
> The symptom is: I get the following error message: *invalid frontend
> message type 78*
> *Please, don't stop reading here and tell me I have a memory corruption in
> my application. It is not the case. I did my home work !*
Unfortunately, that's exactly the conclusion anyone would draw here.
libpq does not contain any threading support per se: if you use it in
a multithreaded application, it's on you to ensure that each PGconn
object is accessed by only one thread at a time. These symptoms are
completely consistent with the idea that you messed that up somewhere.
It's a bit of a leap of logic to guess that the problem is triggered by
notice-message handling, but if you are installing a custom message
processor, that's where I'd look first, for sure.
regards, tom lane