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 1lZrUF-0006S3-AJ for pgsql-general@arkaria.postgresql.org; Fri, 23 Apr 2021 08:48:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lZrUE-0001JU-9A for pgsql-general@arkaria.postgresql.org; Fri, 23 Apr 2021 08:48:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lZrUE-0001JN-16 for pgsql-general@lists.postgresql.org; Fri, 23 Apr 2021 08:48:30 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lZrUB-00051c-K6 for pgsql-general@lists.postgresql.org; Fri, 23 Apr 2021 08:48:29 +0000 Received: by mail-wr1-x435.google.com with SMTP id e7so38556882wrs.11 for ; Fri, 23 Apr 2021 01:48:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=cLiZ21Tnf9gCZpOAmi+XGkGuvoJQF2wjHsea4k2y798=; b=f8JgLqp1rpg/I4R2o8DDBcvu7zuUSwQLOP0wM66k3JwljjecIRvbZRgIfUeJWwQ722 reo3ogV5CcckVejk4wmrM/vT+stlIAs3MLdGHE39CxNm1Pxp2XdwMU0AyGRHbMHmKEKn CcpxX81spC+nb7Pj/IY6mbRyFjWlzIsVO1gaxJNkoH7TgrRPHp/QWYnv7uZLVYhPcZgA UwAWKwyhobe0dpc3O0ZN1eJk2HIp3sf/B7jXf8pUX1hxT/ChQBIVz+2kLL1pR8VUwCKo yw+Y7AJv5tv6nFgj6ZixGmmJZrA+oFo010qH0xB9Dgw707gh2l/RTVG9bd+jvutq/kj7 kfIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=cLiZ21Tnf9gCZpOAmi+XGkGuvoJQF2wjHsea4k2y798=; b=Ue6uGM5iRTfaFPF3U6vlTLSG+4HBz0HQnh9uaC1TIjqZNObwuWZi2AQJIB74iolCZQ PUjSYT2XzMVZrEfO7bhFRQ3LgnwHqTn55pQ77B1q/DkoUPazZQHw39O4GTO0kzKRfDIf nOlRmBcss349dv/H1f02YcfXeGSF1x2VgcPKAYkE8PbLf3L4TUTfUm0p70P4ASbnChps odyjyDVYH4TDUWSTDmtWt46B+o8+mf43nu4QBTkRa9tFvoLBuyVb5bvXh+5Exgf/imQx ZIGXP7lsxgF/mHIR4ywW6Cun25RbKTE2J2z0fcBWHYBgpPNin79oKIh30pav4Gz1VKyN 8YsA== X-Gm-Message-State: AOAM5325iCiVKqRyD3Azt4UKQega63JO7YiWLqEctRnYFG8zqQjqhEHz WAktUEba1ocfElzRDW/JU8Q8Aw== X-Google-Smtp-Source: ABdhPJz6tHaA+k5/5jqCvsEHguCJzADD/JAVLvFhsRT9XIVSPIz9QAXwM9iIE6ABPU2NuYCcYMSeAQ== X-Received: by 2002:a5d:4d0b:: with SMTP id z11mr3418856wrt.164.1619167705915; Fri, 23 Apr 2021 01:48:25 -0700 (PDT) Received: from localhost.localdomain (217-149-165-217.nat.highway.telekom.at. [217.149.165.217]) by smtp.gmail.com with ESMTPSA id q18sm8040321wrs.25.2021.04.23.01.48.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Apr 2021 01:48:25 -0700 (PDT) Message-ID: <0551daad25ee518071e002ca17c4b6dac08a236c.camel@cybertec.at> Subject: Re: client waits for end of update operation and server proc is idle From: Laurenz Albe To: Matthias Apitz , pgsql-general@lists.postgresql.org Date: Fri, 23 Apr 2021 10:48:24 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2021-04-23 at 10:15 +0200, Matthias Apitz wrote: > We face (somehow reproducible) the following situation with a 13.1 > server and a client written in ESQL/C: > > # ps ax | grep post > ... > 27106 ? Ss 0:00 postgres: sisis sisis ::1(49518) idle in transaction > > # lsof | grep 49518 > INDEX 27074 sisis 2u IPv6 26465150 0t0 TCP localhost:49518->localhost:postgresql (ESTABLISHED) > postmaste 27106 postgres 9u IPv6 26464149 0t0 TCP localhost:postgresql->localhost:49518 (ESTABLISHED) > > sisis=# select * from pg_stat_activity where client_port = 49518; > > [...] ClientRead | idle in transaction [...] > > The ESQL/C code the client is executing at this moment is: > > /* > * update the actual row > */ > posDebug(POSDEBUG_FLOW, "ES UPDATE per_kette set .. WHERE CURRENT OF hc_per_kette"); > EXEC SQL UPDATE per_kette > SET desknr =:hrec_per_kette.desknr, > frei =:hrec_per_kette.frei, > modif =:hrec_per_kette.modif, > anz =:hrec_per_kette.anz, > katlist =:hrec_per_kette.katlist > WHERE CURRENT OF hc_per_kette; > > An attached GDB shows: > > # gdb /opt/lib/sisis/catserver/bin/INDEX 27074 > > #0 0x00007f1e65c1b5c4 in poll () from /lib64/libc.so.6 > #1 0x00007f1e648ac22f in pqSocketPoll () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5 > #2 0x00007f1e648ac0ff in pqSocketCheck () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5 > #3 0x00007f1e648abf83 in pqWaitTimed () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5 > #4 0x00007f1e648abf55 in pqWait () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5 > #5 0x00007f1e648a7d3a in PQgetResult () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5 > #6 0x00007f1e648a8478 in PQexecFinish () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5 > #7 0x00007f1e648a812e in PQexecParams () from /usr/local/sisis-pap/pgsql/lib/libpq.so.5 > #8 0x00007f1e65818216 in ecpg_execute () > from /usr/local/sisis-pap/pgsql/lib/libecpg.so.6 > #9 0x00007f1e658195de in ecpg_do () from /usr/local/sisis-pap/pgsql/lib/libecpg.so.6 > #10 0x00007f1e658196ef in ECPGdo () from /usr/local/sisis-pap/pgsql/lib/libecpg.so.6 > > i.e. our client issued ECPGdo() and now waits on finish; the provided > data looks fine: > > the server pocess is in epoll_pwait(): > > # gdb /usr/local/sisis-pap/pgsql-13.0/bin/postmaster 27106 > ... > (gdb) bt > #0 0x00007fe7ee953fe0 in epoll_pwait () from /lib64/libc.so.6 > #1 0x00000000008acf10 in WaitEventSetWaitBlock () > #2 0x00000000008acde9 in WaitEventSetWaitBlock () > #3 0x000000000073c5a5 in check_ssl_key_file_permissions () > #4 0x000000000074636e in RemoveSocketFiles () > #5 0x000000000074662b in pq_getbyte_if_available () > #6 0x000000000074697b in pq_getmessage () > #7 0x00000000008d543b in pg_analyze_and_rewrite_params () > > The client has a log file for this update which shows the actual time of > this operation: > > # ls -l --full-time /var/spool/sisis/catserver/tmp/.lock_index-A.sisis.2 > -rw-rw---- 1 sisis sisis 6 2021-04-23 05:57:19.529476471 +0200 /var/spool/sisis/catserver/tmp/.lock_index-A.sisis.2 > > > The serverlog has around this time (sorry for German): > > 2021-04-23 05:55:23.591 CEST [2317] LOG: unvollständige Message vom Client > 2021-04-23 05:55:23.593 CEST [2317] FEHLER: Speicher aufgebraucht > 2021-04-23 05:55:23.593 CEST [2317] DETAIL: Kann Zeichenkettenpuffer mit 0 Bytes nicht um 1380986158 Bytes vergrößern. > 2021-04-23 05:55:23.593 CEST [2317] LOG: konnte Daten nicht an den Client senden: Datenübergabe unterbrochen (broken pipe) > 2021-04-23 05:55:23.593 CEST [2317] FATAL: Verbindung zum Client wurde verloren > 2021-04-23 05:57:20.339 CEST [27190] LOG: unerwartetes EOF auf Client-Verbindung mit einer offenen Transaktion > 2021-04-23 05:59:17.419 CEST [26827] LOG: unerwartetes EOF auf Client-Verbindung mit einer offenen Transaktion > > What else could be checked for this? Any hints about this issue? It seems pretty clear that both the client and the server are waiting for each other. The server is of the opinion that it has completed the query, while the client is still waiting for the response. I would look for the problem in the network between both. The error messages (unexpected EOF on client connection, broken pipe) seem to point in the same direction. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com