[pgpool-hackers: 4403] Re: [pgpool-hackers] ERROR: unable to read message kind from backend

Tatsuo Ishii ishii at sraoss.co.jp
Fri Sep 29 15:50:58 JST 2023


> Hi Everyone,
> 
> I am running a Java customer application with PgPool LB feature with 2 DB nodes.
> After some analysis, I figured out something as below:
> 
> In pool_pending_message_query_context_dest_set(), it sets
> where_to_send field in query context, which tells to which node the
> msg was sent.
> 
> /* Save where_to_send map */
> memcpy(s->where_to_send_save, query_context->where_to_send,
> sizeof(s->where_to_send_save));
> s->need_to_restore_where_to_send = true;
> 
>  /* Rewrite where_to_send map */
> memset(query_context->where_to_send, 0, sizeof(query_context->where_to_send));
> 
> for (i = 0; i < MAX_NUM_BACKENDS; i++)
> {
>       if (message->node_ids[i])
>            query_context->where_to_send[i] = 1;
> }
> 
> Here where_to_send field has been stored in session_context and memset
> to 0 in query_context. Then we are setting it back only w.r.t nodeid
> for which the msg has been sent.
> 
> At the end of the function, where_to_send field will be set to 1 only
> for Node0, but for all other nodes, it will be 0.
> 
> LOG:  Message is SHOW TRANSACTION ISOLATION LEVEL
> LOG:  pool_pending_message_query_context_dest_set:1251: Where to send
> for Node0 is 1 & Where to send for Node1 is 0
> 
> Next it is going to “read_kind_from_one_backend()“, with MAIN_NODE_ID
> as 1, for which where_to_send is already set to 0 as explained above.
> Here we are considering the backend node 1 is not valid and raising
> the error as:
> ERROR: unable to read message kind from backend
> Detail: 1 th backend is not valid
> 
> I am focusing further if the MAIN_NODE_ID is set wrong somehow. But
> any help or suggestions ? Please let me know..

Hard to tell without knowing what Pgpool-II version you are using.
Also a self contained test case would be useful.

Best reagards,
--
Tatsuo Ishii
SRA OSS LLC
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp


More information about the pgpool-hackers mailing list