pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #16897: gssenc request slow connection
10+ messages / 4 participants
[nested] [flat]
* BUG #16897: gssenc request slow connection
@ 2021-02-25 10:46 PG Bug reporting form <noreply@postgresql.org>
2021-02-25 17:43 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
0 siblings, 1 reply; 10+ messages in thread
From: PG Bug reporting form @ 2021-02-25 10:46 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: rich.crampton@gmail.com
The following bug has been logged on the website:
Bug reference: 16897
Logged by: Richard Crampton
Email address: rich.crampton@gmail.com
PostgreSQL version: 12.6
Operating system: client Windows 10, postgresql server Ubuntu
Description:
When connecting over a local network from Windows 10 to PostgreSQL server
(Linux version 12.6 default install) the gssencmode=prefer in libpq
connection causes a big slowdown.
With "gssencmode=prefer" connection takes 4 seconds.
With "gssencmode=disable" connection as fast as normal.
As the prefer option is the default option this causes problems in dependent
libraries such as psycopg2 for Python. First raised the bug here
https://github.com/psycopg/psycopg2/issues/1242 but I think this must be a
libpq/Postgresql bug since psycopg2 is just passing along the request.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: BUG #16897: gssenc request slow connection
2021-02-25 10:46 BUG #16897: gssenc request slow connection PG Bug reporting form <noreply@postgresql.org>
@ 2021-02-25 17:43 ` Stephen Frost <sfrost@snowman.net>
2021-02-25 18:46 ` Re: BUG #16897: gssenc request slow connection Richard Crampton <rich.crampton@gmail.com>
2021-02-25 19:29 ` Re: BUG #16897: gssenc request slow connection Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 10+ messages in thread
From: Stephen Frost @ 2021-02-25 17:43 UTC (permalink / raw)
To: rich.crampton@gmail.com; pgsql-bugs@lists.postgresql.org
Greetings,
* PG Bug reporting form (noreply@postgresql.org) wrote:
> Email address: rich.crampton@gmail.com
> PostgreSQL version: 12.6
> Operating system: client Windows 10, postgresql server Ubuntu
> Description:
>
> When connecting over a local network from Windows 10 to PostgreSQL server
> (Linux version 12.6 default install) the gssencmode=prefer in libpq
> connection causes a big slowdown.
>
> With "gssencmode=prefer" connection takes 4 seconds.
> With "gssencmode=disable" connection as fast as normal.
>
> As the prefer option is the default option this causes problems in dependent
> libraries such as psycopg2 for Python. First raised the bug here
> https://github.com/psycopg/psycopg2/issues/1242 but I think this must be a
> libpq/Postgresql bug since psycopg2 is just passing along the request.
What's the version of the libpq library on the client side..? In
general, while there's an extra packet back and forth because Kerberos /
GSSAPI is set up on the client / Windows side, once the server says it
doesn't support GSSENC, libpq should try a non-GSSENC connection right
away..
Thanks,
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: BUG #16897: gssenc request slow connection
2021-02-25 10:46 BUG #16897: gssenc request slow connection PG Bug reporting form <noreply@postgresql.org>
2021-02-25 17:43 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
@ 2021-02-25 18:46 ` Richard Crampton <rich.crampton@gmail.com>
2021-02-25 18:58 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
1 sibling, 1 reply; 10+ messages in thread
From: Richard Crampton @ 2021-02-25 18:46 UTC (permalink / raw)
To: Stephen Frost <sfrost@snowman.net>; +Cc: pgsql-bugs@lists.postgresql.org
Hi,
The libpq version is 12.2. I've attached two images of the packets
transferred on a connection to my db with gssenc=prefer and
gssenc=disable. The client is 10.64.0.3 and the host is 10.64.0.7.
In the gssenc image packet 3155 is the gssenc request. I don't know what
the NBNS packets are doing but they seem to be the cause of the delay.
Cols: No, Time, Source, Destination, Protocol, Length, Info
Thx,
Richard
On Thu, 25 Feb 2021 at 17:43, Stephen Frost <sfrost@snowman.net> wrote:
> Greetings,
>
> * PG Bug reporting form (noreply@postgresql.org) wrote:
> > Email address: rich.crampton@gmail.com
> > PostgreSQL version: 12.6
> > Operating system: client Windows 10, postgresql server Ubuntu
> > Description:
> >
> > When connecting over a local network from Windows 10 to PostgreSQL server
> > (Linux version 12.6 default install) the gssencmode=prefer in libpq
> > connection causes a big slowdown.
> >
> > With "gssencmode=prefer" connection takes 4 seconds.
> > With "gssencmode=disable" connection as fast as normal.
> >
> > As the prefer option is the default option this causes problems in
> dependent
> > libraries such as psycopg2 for Python. First raised the bug here
> > https://github.com/psycopg/psycopg2/issues/1242 but I think this must
> be a
> > libpq/Postgresql bug since psycopg2 is just passing along the request.
>
> What's the version of the libpq library on the client side..? In
> general, while there's an extra packet back and forth because Kerberos /
> GSSAPI is set up on the client / Windows side, once the server says it
> doesn't support GSSENC, libpq should try a non-GSSENC connection right
> away..
>
> Thanks,
>
> Stephen
>
Attachments:
gssenc.JPG (image/jpeg, 234.5K) download
view image
nogssenc.JPG (image/jpeg, 86.6K) download
view image
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: BUG #16897: gssenc request slow connection
2021-02-25 10:46 BUG #16897: gssenc request slow connection PG Bug reporting form <noreply@postgresql.org>
2021-02-25 17:43 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
2021-02-25 18:46 ` Re: BUG #16897: gssenc request slow connection Richard Crampton <rich.crampton@gmail.com>
@ 2021-02-25 18:58 ` Stephen Frost <sfrost@snowman.net>
2021-02-25 19:22 ` Re: BUG #16897: gssenc request slow connection Richard Crampton <rich.crampton@gmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: Stephen Frost @ 2021-02-25 18:58 UTC (permalink / raw)
To: Richard Crampton <rich.crampton@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org
Greetings,
* Richard Crampton (rich.crampton@gmail.com) wrote:
> The libpq version is 12.2. I've attached two images of the packets
> transferred on a connection to my db with gssenc=prefer and
> gssenc=disable. The client is 10.64.0.3 and the host is 10.64.0.7.
> In the gssenc image packet 3155 is the gssenc request. I don't know what
> the NBNS packets are doing but they seem to be the cause of the delay.
First thing to do would certainly be to update to the latest libpq
release, there's been a number of improvements and bug fixes.
Thanks,
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: BUG #16897: gssenc request slow connection
2021-02-25 10:46 BUG #16897: gssenc request slow connection PG Bug reporting form <noreply@postgresql.org>
2021-02-25 17:43 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
2021-02-25 18:46 ` Re: BUG #16897: gssenc request slow connection Richard Crampton <rich.crampton@gmail.com>
2021-02-25 18:58 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
@ 2021-02-25 19:22 ` Richard Crampton <rich.crampton@gmail.com>
2021-02-25 21:40 ` Re: BUG #16897: gssenc request slow connection Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 10+ messages in thread
From: Richard Crampton @ 2021-02-25 19:22 UTC (permalink / raw)
To: Stephen Frost <sfrost@snowman.net>; +Cc: pgsql-bugs@lists.postgresql.org
I just upgraded to libpq=13.1 with no change in result. Is there anything
newer? I'm not sure whether it's relevant but my krb5 version is 1.17.1
and I can't upgrade this without breaking dependencies.
Thx,
Richard
On Thu, 25 Feb 2021 at 18:58, Stephen Frost <sfrost@snowman.net> wrote:
> Greetings,
>
> * Richard Crampton (rich.crampton@gmail.com) wrote:
> > The libpq version is 12.2. I've attached two images of the packets
> > transferred on a connection to my db with gssenc=prefer and
> > gssenc=disable. The client is 10.64.0.3 and the host is 10.64.0.7.
> > In the gssenc image packet 3155 is the gssenc request. I don't know what
> > the NBNS packets are doing but they seem to be the cause of the delay.
>
> First thing to do would certainly be to update to the latest libpq
> release, there's been a number of improvements and bug fixes.
>
> Thanks,
>
> Stephen
>
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: BUG #16897: gssenc request slow connection
2021-02-25 10:46 BUG #16897: gssenc request slow connection PG Bug reporting form <noreply@postgresql.org>
2021-02-25 17:43 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
2021-02-25 18:46 ` Re: BUG #16897: gssenc request slow connection Richard Crampton <rich.crampton@gmail.com>
2021-02-25 18:58 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
2021-02-25 19:22 ` Re: BUG #16897: gssenc request slow connection Richard Crampton <rich.crampton@gmail.com>
@ 2021-02-25 21:40 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 10+ messages in thread
From: Tom Lane @ 2021-02-25 21:40 UTC (permalink / raw)
To: Richard Crampton <rich.crampton@gmail.com>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-bugs@lists.postgresql.org
Richard Crampton <rich.crampton@gmail.com> writes:
> I just upgraded to libpq=13.1 with no change in result. Is there anything
> newer? I'm not sure whether it's relevant but my krb5 version is 1.17.1
> and I can't upgrade this without breaking dependencies.
There were several GSSENC bugs fixed in this month's PG releases
(13.2 and 12.6). While I don't think any of them would explain this
symptom, I'd still recommend an update if you intend to rely on GSS
encryption.
Don't know anything about the bug history on the kerberos side,
but 1.17.1 isn't hugely old so I'd guess you're okay there.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: BUG #16897: gssenc request slow connection
2021-02-25 10:46 BUG #16897: gssenc request slow connection PG Bug reporting form <noreply@postgresql.org>
2021-02-25 17:43 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
@ 2021-02-25 19:29 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-02-25 20:00 ` Re: BUG #16897: gssenc request slow connection Richard Crampton <rich.crampton@gmail.com>
1 sibling, 1 reply; 10+ messages in thread
From: Tom Lane @ 2021-02-25 19:29 UTC (permalink / raw)
To: Stephen Frost <sfrost@snowman.net>; +Cc: rich.crampton@gmail.com; pgsql-bugs@lists.postgresql.org
Stephen Frost <sfrost@snowman.net> writes:
> What's the version of the libpq library on the client side..? In
> general, while there's an extra packet back and forth because Kerberos /
> GSSAPI is set up on the client / Windows side, once the server says it
> doesn't support GSSENC, libpq should try a non-GSSENC connection right
> away..
I'm wondering if the server DOES say it supports GSSENC, and the delay
is involved in the two sides not realizing they aren't talking to the
same Kerberos/AD servers, or something like that.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: BUG #16897: gssenc request slow connection
2021-02-25 10:46 BUG #16897: gssenc request slow connection PG Bug reporting form <noreply@postgresql.org>
2021-02-25 17:43 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
2021-02-25 19:29 ` Re: BUG #16897: gssenc request slow connection Tom Lane <tgl@sss.pgh.pa.us>
@ 2021-02-25 20:00 ` Richard Crampton <rich.crampton@gmail.com>
2021-02-25 20:24 ` Re: BUG #16897: gssenc request slow connection Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 10+ messages in thread
From: Richard Crampton @ 2021-02-25 20:00 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-bugs@lists.postgresql.org
It's not enabled in my pg_hba.conf which I've attached...
On Thu, 25 Feb 2021 at 19:29, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Stephen Frost <sfrost@snowman.net> writes:
> > What's the version of the libpq library on the client side..? In
> > general, while there's an extra packet back and forth because Kerberos /
> > GSSAPI is set up on the client / Windows side, once the server says it
> > doesn't support GSSENC, libpq should try a non-GSSENC connection right
> > away..
>
> I'm wondering if the server DOES say it supports GSSENC, and the delay
> is involved in the two sides not realizing they aren't talking to the
> same Kerberos/AD servers, or something like that.
>
> regards, tom lane
>
Attachments:
pg_hba.conf.txt (text/plain, 4.8K) download
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file. A short
# synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
#
# local DATABASE USER METHOD [OPTIONS]
# host DATABASE USER ADDRESS METHOD [OPTIONS]
# hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
# hostgssenc DATABASE USER ADDRESS METHOD [OPTIONS]
# hostnogssenc DATABASE USER ADDRESS METHOD [OPTIONS]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain
# socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
# non-SSL TCP/IP socket. Similarly, "hostgssenc" uses a
# GSSAPI-encrypted TCP/IP socket, while "hostnogssenc" uses a
# non-GSSAPI socket.
#
# DATABASE can be "all", "sameuser", "samerole", "replication", a
# database name, or a comma-separated list thereof. The "all"
# keyword does not match "replication". Access to replication
# must be enabled in a separate record (see example below).
#
# USER can be "all", a user name, a group name prefixed with "+", or a
# comma-separated list thereof. In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names
# from a separate file.
#
# ADDRESS specifies the set of hosts the record matches. It can be a
# host name, or it is made up of an IP address and a CIDR mask that is
# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
# specifies the number of significant bits in the mask. A host name
# that starts with a dot (.) matches a suffix of the actual host name.
# Alternatively, you can write an IP address and netmask in separate
# columns to specify the set of hosts. Instead of a CIDR-address, you
# can write "samehost" to match any of the server's own IP addresses,
# or "samenet" to match any address in any subnet that the server is
# directly connected to.
#
# METHOD can be "trust", "reject", "md5", "password", "scram-sha-256",
# "gss", "sspi", "ident", "peer", "pam", "ldap", "radius" or "cert".
# Note that "password" sends passwords in clear text; "md5" or
# "scram-sha-256" are preferred since they send encrypted passwords.
#
# OPTIONS are a set of options for the authentication in the format
# NAME=VALUE. The available options depend on the different
# authentication methods -- refer to the "Client Authentication"
# section in the documentation for a list of which options are
# available for which authentication methods.
#
# Database and user names containing spaces, commas, quotes and other
# special characters must be quoted. Quoting one of the keywords
# "all", "sameuser", "samerole" or "replication" makes the name lose
# its special character, and just match a database or username with
# that name.
#
# This file is read on server startup and when the server receives a
# SIGHUP signal. If you edit the file on a running system, you have to
# SIGHUP the server for the changes to take effect, run "pg_ctl reload",
# or execute "SELECT pg_reload_conf()".
#
# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.
# CAUTION: Configuring the system for local "trust" authentication
# allows any local user to connect as any PostgreSQL user, including
# the database superuser. If you do not trust all your local users,
# use another authentication method.
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
host all all all md5
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: BUG #16897: gssenc request slow connection
2021-02-25 10:46 BUG #16897: gssenc request slow connection PG Bug reporting form <noreply@postgresql.org>
2021-02-25 17:43 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
2021-02-25 19:29 ` Re: BUG #16897: gssenc request slow connection Tom Lane <tgl@sss.pgh.pa.us>
2021-02-25 20:00 ` Re: BUG #16897: gssenc request slow connection Richard Crampton <rich.crampton@gmail.com>
@ 2021-02-25 20:24 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-02-25 20:52 ` Re: BUG #16897: gssenc request slow connection Richard Crampton <rich.crampton@gmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: Tom Lane @ 2021-02-25 20:24 UTC (permalink / raw)
To: Richard Crampton <rich.crampton@gmail.com>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-bugs@lists.postgresql.org
Richard Crampton <rich.crampton@gmail.com> writes:
> It's not enabled in my pg_hba.conf which I've attached...
pg_hba.conf has zero to do with this. That's only an after-the-fact
filter, besides which you haven't actually forbidden gssenc there.
The important questions are (1) was the server built with --with-gssapi
(probably, if your client was); (2) is a Kerberos ticket available
to the server? If so, it will be willing to engage in a gss negotiation
with the client. Given the data you've provided so far, it seems
highly likely that (1) and (2) are true, since as Stephen says the
case where gss is immediately rejected shouldn't take long.
I think it's nearly certain that the problem is not really PG's, but
reflects some sort of issue in your Kerberos/AD infrastructure.
We don't have enough info to speculate about exactly what, though.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: BUG #16897: gssenc request slow connection
2021-02-25 10:46 BUG #16897: gssenc request slow connection PG Bug reporting form <noreply@postgresql.org>
2021-02-25 17:43 ` Re: BUG #16897: gssenc request slow connection Stephen Frost <sfrost@snowman.net>
2021-02-25 19:29 ` Re: BUG #16897: gssenc request slow connection Tom Lane <tgl@sss.pgh.pa.us>
2021-02-25 20:00 ` Re: BUG #16897: gssenc request slow connection Richard Crampton <rich.crampton@gmail.com>
2021-02-25 20:24 ` Re: BUG #16897: gssenc request slow connection Tom Lane <tgl@sss.pgh.pa.us>
@ 2021-02-25 20:52 ` Richard Crampton <rich.crampton@gmail.com>
0 siblings, 0 replies; 10+ messages in thread
From: Richard Crampton @ 2021-02-25 20:52 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Stephen Frost <sfrost@snowman.net>; pgsql-bugs@lists.postgresql.org
Ok, thanks for the feedback. If you don't think it's a PG bug then I guess
we can leave it here.
Given the issue I would have expected more users to have reported a problem
so perhaps it could be my specific setup.
Regards,
Richard
On Thu, 25 Feb 2021, 20:24 Tom Lane, <tgl@sss.pgh.pa.us> wrote:
> Richard Crampton <rich.crampton@gmail.com> writes:
> > It's not enabled in my pg_hba.conf which I've attached...
>
> pg_hba.conf has zero to do with this. That's only an after-the-fact
> filter, besides which you haven't actually forbidden gssenc there.
>
> The important questions are (1) was the server built with --with-gssapi
> (probably, if your client was); (2) is a Kerberos ticket available
> to the server? If so, it will be willing to engage in a gss negotiation
> with the client. Given the data you've provided so far, it seems
> highly likely that (1) and (2) are true, since as Stephen says the
> case where gss is immediately rejected shouldn't take long.
>
> I think it's nearly certain that the problem is not really PG's, but
> reflects some sort of issue in your Kerberos/AD infrastructure.
> We don't have enough info to speculate about exactly what, though.
>
> regards, tom lane
>
^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2021-02-25 21:40 UTC | newest]
Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-02-25 10:46 BUG #16897: gssenc request slow connection PG Bug reporting form <noreply@postgresql.org>
2021-02-25 17:43 ` Stephen Frost <sfrost@snowman.net>
2021-02-25 18:46 ` Richard Crampton <rich.crampton@gmail.com>
2021-02-25 18:58 ` Stephen Frost <sfrost@snowman.net>
2021-02-25 19:22 ` Richard Crampton <rich.crampton@gmail.com>
2021-02-25 21:40 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-02-25 19:29 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-02-25 20:00 ` Richard Crampton <rich.crampton@gmail.com>
2021-02-25 20:24 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-02-25 20:52 ` Richard Crampton <rich.crampton@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox