[pgpool-hackers: 3795] Re: [pgpool-committers: 7057] pgpool: Display more informative error message in authentication proces

Tatsuo Ishii ishii at sraoss.co.jp
Sun Aug 30 12:15:29 JST 2020


I noticed that current backend authentication code does not respect
the informative message in pool_do_auth:

	message_length = pool_read_message_length(cp);
	if (message_length <= 0)
        ereport(ERROR,
                        (errmsg("invalid authentication packet from backend"),
                         errdetail("failed to get the authentication packet length"),
                         errhint("This is likely caused by the inconsistency of auth method among DB nodes. \
                                                Please check the previous error messages (hint: length field) \
                                                from pool_read_message_length and recheck the pg_hba.conf settings.")));

because pool_read_message_length() aborts inside it with
ereport(ERROR) if a message length does not match with master node. I
have fixed this by changing pool_read_message() so that the
erepor(ERRROR) is replaced with ereport(LOG). This inconsistency
between modules probably has started since ereport was introduced long
time ago. I am surprised that no one (including me) noticed this until
today:-)

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

From: Tatsuo Ishii <ishii at sraoss.co.jp>
Subject: [pgpool-committers: 7057] pgpool: Display more informative error message in authentication proces
Date: Sun, 30 Aug 2020 02:21:07 +0000
Message-ID: <E1kCCxv-0002uz-SL at gothos.postgresql.org>

> Display more informative error message in authentication process.
> 
> When backends offers mistakenly different authentication methods,
> pgpool just showed:
> 
>         "unable to read message length"
>         "message length (%d) in slot %d does not match with slot 0(%d)", length, i, length0)));
> 
> because pool_read_message_length() called ereport(ERROR) in this
> case. Actually the caller pool_do_auth() prepared more informative
> message:
> 
>         ereport(ERROR,
>                         (errmsg("invalid authentication packet from backend"),
>                          errdetail("failed to get the authentication packet length"),
>                          errhint("This is likely caused by the inconsistency of auth method among DB nodes. \
>                                                 Please check the previous error messages (hint: length field) \
>                                                 from pool_read_message_length and recheck the pg_hba.conf settings.")));
> 
> Change ereport(ERROR) to ereport(LOG) in pool_read_message_length() so
> that the informative message actually shows up.
> 
> Branch
> ------
> master
> 
> Details
> -------
> https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=ef3d830f7182669c11527391228c1d9759336b4a
> 
> Modified Files
> --------------
> src/protocol/pool_proto_modules.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
> 


More information about the pgpool-hackers mailing list