Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okOvC-0003Mf-RA for psycopg@arkaria.postgresql.org; Mon, 17 Oct 2022 12:08:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1okOvB-0002uy-O2 for psycopg@arkaria.postgresql.org; Mon, 17 Oct 2022 12:08:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okOvB-0002uY-FN for psycopg@lists.postgresql.org; Mon, 17 Oct 2022 12:08:41 +0000 Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1okOv9-00006S-Dr for psycopg@postgresql.org; Mon, 17 Oct 2022 12:08:40 +0000 Received: by mail-yb1-xb2a.google.com with SMTP id r3so12991866yba.5 for ; Mon, 17 Oct 2022 05:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IXM0yd/x/F4ZjgYkNHEwFa9b/TyFB6iILNLSgkOS+0Q=; b=HB7nosFNRwui+68VH+esanw3/iCG60FsGE+efWQ+k14/hS7302PoKjF8SFnRUSjfFM O4oVKsKEyGDTbnEZMJ4N6+w+eqzgMQM7j0HcFnoUDkdjMS4OQj3q/YfxzRvZETDopLjZ ZeSiI2LmqlUc4yA0j0YKAejdUmRqpqGLORI/e4XVDBV16Dqf7UvRnNubm2TtM3sTB/3x Gstc9ZLwJvUu5Kh2F3BKp9XACWZvQAt5+9kmtIYri0V2fnXjIu/iznfNbm1Ec7kRkimx yWjYACBiwEupKz91Z9edPXuAEHN/La3n5OMg5RFj03LYQxa9pYdcmjZM6jT/RlIKv/2c 54Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IXM0yd/x/F4ZjgYkNHEwFa9b/TyFB6iILNLSgkOS+0Q=; b=FcUbgVOosPMexb6PMtIcFLAtwOL9Ev3gdd14IM4Zt6vYWYKoV2dT8KncavGBevTXiF WuUXZuTrTlFYIbrOowUTkw/RhqqJ5hImjKKntcjWrA7dHDyUvZc7sg/upti0mRMUkF1f An2RlzPFPrXyOwGAfitfhNpUB/MPKRi40rAH/Fb4lVYzEZHAWIrNAwpjF3ZvYY1PyeeB OKl4RoWeaBoSWs9bvjZ/LS3I8PJSku3dpFXfFAPpa1whyB619uXPmun3afZXywnQl8A/ +nugb3K1/78MeTm24FyMwpd/1m6HOagltYOxBJqf2suLpT+jSHc2sMH8ZdSM+yrn4hIe fV1w== X-Gm-Message-State: ACrzQf0YZfYVQR9Q34aOJn7L51+KT6RX1JXiQoComzu5DpyIncLb3sD/ S2pXmVNjRVhlb6sA6rTv1hKJhvMwGLJDYJvP/WZcSTqNpoo= X-Google-Smtp-Source: AMsMyM6Yfn1ynMC68oqU75LTI+lbE/nKHQM4C/EbzQlQIV/AGB+6irVVDMXJDM3kjLStu/tYULAlvgCc9qJAkZYWc6I= X-Received: by 2002:a25:ff11:0:b0:6b2:8bc4:c1a6 with SMTP id c17-20020a25ff11000000b006b28bc4c1a6mr8521597ybe.606.1666008517732; Mon, 17 Oct 2022 05:08:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Stefan Knecht Date: Mon, 17 Oct 2022 19:08:27 +0700 Message-ID: Subject: Re: Puzzling situation with threads and psycopg2 on RDS To: Daniele Varrazzo Cc: psycopg@postgresql.org Content-Type: multipart/alternative; boundary="000000000000e46c3305eb39d5e1" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e46c3305eb39d5e1 Content-Type: text/plain; charset="UTF-8" Ciao Daniele Thanks for looking at this. > I understand this happens on RDS. Does it happen on normal Postgres > too, from a normal process (not some serverless thing?) > > I'll test this now. > Are there processes/forks involved? No, just Python's basic threading. > Which version of psycopg are you > using? Some old one have problems with closing connections in > multiprocess environments. That was fixed in psycopg 2.8 (#829). > > This is psycopg 3.1.3 And I just realized that all the other threading code I've got is on psycopg2-binary 2.8. Has there something changed with threads in v3 ? Stefan --000000000000e46c3305eb39d5e1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ciao Daniele

Thanks for looking at this.



I understand this happens on RDS. Does it happen on normal Postgres
too, from a normal process (not some serverless thing?)


I'll test this now.
=C2=A0
Are there processes/forks involved?

No, ju= st Python's basic threading.
=C2=A0
Which version of psycopg are you
using? Some old one have problems with closing connections in
multiprocess environments. That was fixed in psycopg 2.8 (#829).


This is psycopg 3.1.3
=C2=A0=
And I just realized that all the other threading code I've g= ot is on psycopg2-binary 2.8. Has there something changed with threads in v= 3 ?



Stefan

= --000000000000e46c3305eb39d5e1--