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 1nN2YV-00050f-T2 for pgsql-performance@arkaria.postgresql.org; Thu, 24 Feb 2022 01:04:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nN2YU-0006o9-FT for pgsql-performance@arkaria.postgresql.org; Thu, 24 Feb 2022 01:04:26 +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 1nN2YU-0006nz-1V for pgsql-performance@lists.postgresql.org; Thu, 24 Feb 2022 01:04:26 +0000 Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nN2YM-0002xi-Tl for pgsql-performance@postgresql.org; Thu, 24 Feb 2022 01:04:25 +0000 Received: by mail-io1-xd32.google.com with SMTP id q8so990542iod.2 for ; Wed, 23 Feb 2022 17:04:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=oqSjpHEKmLHEKwUIcXW+jGnykSpPMSIriz1q2YTCTyk=; b=t5I1TtLUSBt/zS9v0dZ9CbsidyuaaEt6WzQc78cIxZuFnvafvx84BwWFL2SYO1DqqU isr7AyF5KsF5E8XQsMqOcWety8NcyDi836q5kX4XVcWLvmrImAPT8SLsoImC+e5thzBB qvAs9DGA6qgH3vgTTzUwoc7XrD6+/0gRbKoRDdOhoiU9umEX+JkkRwdvb0IyD18AtZ5n IdqWo27kdC6DvmIQlwesYev1YKdgMxZe8UzRQMLM1CmeT2vS8+RjsTSz7cVSMydk7ylw eXchDgh4otB/a+JNILZquZ2bTZSdN4l3XcQjkPAtagyHqwwd4EHj4HumQuWj5l345+jY mqgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oqSjpHEKmLHEKwUIcXW+jGnykSpPMSIriz1q2YTCTyk=; b=5ltfHngrcJWYXJYXqw6xIB1BS4SSRF7wxIkFfQdjH9adHUgtkteEWD6Bz7AiD1FTwy uIKfd0WA5XGVd2DGBQ92op8xDRxB6jfjrEPnsyArfxAUvb/0cQwEc6A7m+l9s7w+Bv0D 3BGWJZypXXYzDekIcsFAl93/vJu3F+bXtiTbuSJwdgEUbgoAmW1Mdr1pf4bo8DmytSv0 qrQfigbJ8ofnv1m/eYMD3vPJUFFwGnrk0xBMtX329EZd/6jU77yQ21QgFu48yIxfGZHv FBfYgzORqktcMXKLeTzLMhTv9shuJnptreiVWyHK8vIj6sVjGeBQdQXetI4ZaZaRKy8k YYLg== X-Gm-Message-State: AOAM533jiX7z7pGfnzr5LU09NVRN9ewb/av9px7PJKBTE5321I6maSoC ZpYQgJeyhAXVdkwWjdu4GzIP6g== X-Google-Smtp-Source: ABdhPJzcE+4ZzoKgxcqnOHJdDd9MJP/dRMjQldMwrXt+NuhU2awNwI5nZTDVvBgkrjHs0QprXu138w== X-Received: by 2002:a6b:dd12:0:b0:640:6717:ec09 with SMTP id f18-20020a6bdd12000000b006406717ec09mr237841ioc.69.1645664656925; Wed, 23 Feb 2022 17:04:16 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id u10sm763384iol.7.2022.02.23.17.04.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Feb 2022 17:04:16 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id F3EE8800F3C; Wed, 23 Feb 2022 19:04:15 -0600 (CST) Date: Wed, 23 Feb 2022 19:04:15 -0600 From: Justin Pryzby To: ldh@laurent-hasson.com Cc: pgsql-performance@postgresql.org Subject: Re: An I/O error occurred while sending to the backend (PG 13.4) Message-ID: <20220224010415.GS9008@telsasoft.com> References: <20211204175926.GC17618@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Feb 24, 2022 at 12:47:42AM +0000, ldh@laurent-hasson.com wrote: > On Sat, Dec 04, 2021 at 05:32:10PM +0000, ldh@laurent-hasson.com wrote: > > I have a data warehouse with a fairly complex ETL process that has > > been running for years now across PG 9.6, 11.2 and now 13.4 for the > > past couple of months. I have been getting the error "An I/O error > > occurred while sending to the backend" quite often under load in 13.4 > > which I never used to get on 11.2. I have applied some tricks, particularly > > with the socketTimeout JDBC configuration. > It'd be nice to see a network trace for this too. Using tcpdump or > wireshark. Preferably from the client side. > > Hello Justin, > > It has been ages! The issue has been happening a bit more often recently, as much as once every 10 days or so. As a reminder, the set up is Postgres 13.4 on Windows Server with 16cores and 64GB memory. The scenario where this occurs is an ETL tool called Pentaho Kettle (V7) connecting to the DB for DataWarehouse workloads. The tool is Java-based and connects via JDBC using postgresql-42.2.5.jar. There are no particular settings besides the socketTimeout setting mentioned above. > > The workload has some steps being lots of quick transactions for dimension tables for example, but some fact table calculations, especially large pivots, can make queries run for 40mn up to over an hour (a few of those). > > I caught these in the logs at the time of a failure but unsure what to make of that: > > 2022-02-21 02:10:43.605 EST [1368] LOG: unexpected EOF on client connection with an open transaction > 2022-02-21 02:10:43.605 EST [3304] LOG: could not receive data from client: An existing connection was forcibly closed by the remote host. > > 2022-02-21 02:10:43.605 EST [3304] LOG: unexpected EOF on client connection with an open transaction > 2022-02-21 02:31:38.808 EST [1704] LOG: setsockopt(TCP_USER_TIMEOUT) not supported I suggest to enable CSV logging, which has many more columns of data. Some of them might provide an insight - I'm not sure. log_destination=csvlog (in addition to whatever else you have set). And the aforementioned network trace. You could set a capture filter on TCP SYN|RST so it's not absurdly large. From my notes, it might look like this: (tcp[tcpflags]&(tcp-rst|tcp-syn|tcp-fin)!=0) -- Justin