Thread: Backend message type 0x50 arrived while idle

Backend message type 0x50 arrived while idle

From
"Berman, Phil"
Date:
To all-
I am using Postgres version 6.5.1 in a multithreaded program which is
written in C.  All inserts and updates into any tables are done within the
child process, and there are retrieves from tables both in the parent and
child processes.  Additionally, the child process will insert into and
update a table, and the parent process will retrieve from the same table.
There are loops in both the parent and child processes, so every postgres
call may be made multiple times, with a significant amount of time (seconds
or minutes) between calls.  Invariably, I get a message "backend message
type 0x50 arrived while idle" before the process completes, although the
point where I get this message can vary somewhat.  Can anyone tell me what
this message means, why I am getting it, and/or how to avoid getting it in
the future?

Thanks in advance,
Phil


Re: Backend message type 0x50 arrived while idle

From
Thrasher
Date:
Hi Phil

It also happened to me last week. I found the problem is that you cannot 
share the same connection among processes unless you implement some kind 
of locking (semaphores, ...).

More clearly, I had this problem.

Query QA lasts 5 seconds to perform, and returns answer AA.
Query QB lasts 10 seconds and returns AB.
B is a child process of A.

I launch the parent A. Performs QA. Waits for answer.
I launch the child B. Performs QB. Waits for answer.

Server returns AA, but it gets caught by B !!

So, solutions are:- You open a new backend connection for each process.- You make each process lock before sending QA,
andunlock when 
 
receiving AA.

Hope it helps !!

Thrasher

Berman, Phil wrote:
> To all-
> I am using Postgres version 6.5.1 in a multithreaded program which is
> written in C.  All inserts and updates into any tables are done within the
> child process, and there are retrieves from tables both in the parent and
> child processes.  Additionally, the child process will insert into and
> update a table, and the parent process will retrieve from the same table.
> There are loops in both the parent and child processes, so every postgres
> call may be made multiple times, with a significant amount of time (seconds
> or minutes) between calls.  Invariably, I get a message "backend message
> type 0x50 arrived while idle" before the process completes, although the
> point where I get this message can vary somewhat.  Can anyone tell me what
> this message means, why I am getting it, and/or how to avoid getting it in
> the future?
> 
> Thanks in advance,
> Phil
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 
>