Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iyjap-0004yI-HU for pgsql-general@arkaria.postgresql.org; Mon, 03 Feb 2020 21:49:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iyjao-0007T4-9X for pgsql-general@arkaria.postgresql.org; Mon, 03 Feb 2020 21:49:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iyjam-0007Sw-Jl for pgsql-general@lists.postgresql.org; Mon, 03 Feb 2020 21:49:18 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iyjaf-00041H-92 for pgsql-general@lists.postgresql.org; Mon, 03 Feb 2020 21:49:15 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 158472208A; Mon, 3 Feb 2020 16:49:08 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 03 Feb 2020 16:49:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=J mjKmxrYtDE9Gm/lLI2PvItGCvpWNWF/hSucbnwsrNk=; b=iXwDxakfZlW7kHjyT 1sP8HXI5bSFIJPjPdbdisLZI7r9YcaQzSlwbLjUPbcH8OoYWwxcSoRqaMbcLfl/I m5yl6D55CXIJiQ3f3OB4wfGKBuof2YpceYNxt8z4MJntjekNefBQdVUHithnLa++ c5YJIBSs0hy3hNIKu/KUGRgM/DXaEckYZZEgYbYsTEPzFyiwBXnB7CXkQFVZDUen eMLnxgqjvxVLkA+8BHdb+KV1QbMYddiQeHEGuvUm9Gb0K6rXrw0Dyex0E+bMmQUA GL2+4Or/bx9cmLSN1G+OQ9gG5zQfiV1Avr8lxNb0uG5Cz1EgC7O3YEmisI5ndC9R QTNIw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=JmjKmxrYtDE9Gm/lLI2PvItGCvpWNWF/hSucbnwsr Nk=; b=PPZstNporq+6QzHtU48CoECPRU3zo2/UB9klRtkoUqCqhwPDQ+a2aBNdD K1zUyeRxMkcG9fgBGi3Trzc0tkAbaktqtx6pbspiOFpasJuf/6NyKL6XfZRc/BmQ EUdnY/IPT4QiSOW/5RB2vAZMMCRrCxF+ZFxNrJ1oBx4x3YBKCZWyKIfZiSvvXesJ ZScIOsnsy8qEiVhkGWXXF+kkfWTLTL3+P4aGJ/R6afRQDqvlWdT+7IXHOjVVXQf3 yCFdbvPVPHmbBSJJCuLkvFe5JHBka/3hg0peW4sJnxSg+V1veS5UGcAxW9w4ERA/ 8BwI435vBK6MkZuGa8F4lQMW5NXOw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrgeejgdduhedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtke ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecukfhppeejuddrvdduvddruddvledrud elfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegr ughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id 7581B30600DC; Mon, 3 Feb 2020 16:49:07 -0500 (EST) Subject: Re: Postgres Crashing To: Doug Roberts , pgsql-general@lists.postgresql.org References: From: Adrian Klaver Message-ID: Date: Mon, 3 Feb 2020 13:49:06 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/3/20 1:43 PM, Doug Roberts wrote: > Hello, > > I'm having an issue where a process in Postgres is crashing and cause > the server to go into recovery mode. > > I'm getting the following errors in the log. > > 2020-02-03 14:12:57.473 EST [11992] [0]WARNING:  57P02: terminating > connection because of crash of another server process > 2020-02-03 14:12:57.473 EST [11992] [0]DETAIL:  The postmaster has > commanded this server process to roll back the current transaction and > exit, because another server process exited abnormally and possibly > corrupted shared memory. > 2020-02-03 14:12:57.473 EST [11992] [0]HINT:  In a moment you should be > able to reconnect to the database and repeat your command. > 2020-02-03 14:12:57.473 EST [11992] [0]CONTEXT:  while locking tuple > (4101,2) in relation "containers" > SQL statement "UPDATE containers >            SET type_uid = COALESCE(declared_type_uid, type_uid), >                carton_type_uid = COALESCE(declared_carton_type_uid, > carton_type_uid), >                status_uid = COALESCE(declared_status_uid, status_uid), >                order_uid = COALESCE(in_order_uid, order_uid), >                wave_uid = COALESCE(in_wave_uid, wave_uid), >                length = COALESCE(in_length, carton_length, length), >                width = COALESCE(in_width, carton_width, width), >                height = COALESCE(in_height, carton_height, height), >                weight = COALESCE(in_weight, weight), >                weight_minimum = COALESCE(in_weight_minimum, > weight_minimum), >                weight_maximum = COALESCE(in_weight_maximum, > weight_maximum), >                weight_expected = COALESCE(in_weight_expected, > weight_expected), >                first_seen_decision_point_id = > COALESCE(first_seen_decision_point_id, in_last_seen_decision_point_id), >                first_seen_datetime = COALESCE(first_seen_datetime, > last_seen_date_time), >                last_seen_decision_point_id = > COALESCE(in_last_seen_decision_point_id, last_seen_decision_point_id), >                last_seen_datetime = COALESCE(last_seen_date_time, > last_seen_datetime), >                recirculation_count = COALESCE(in_recirculation_count, > recirculation_count), >                project_flags = COALESCE(in_project_flags, project_flags), >                passed_weight_check = COALESCE(in_passed_weight_check, > passed_weight_check) >            WHERE uid = in_uid" > PL/pgSQL function > containers_add_update(integer,integer,integer,integer,integer,integer,double > precision,double precision,double precision,double precision,double > precision,double precision,double precision,integer,timestamp without > time zone,character varying,bigint,boolean) line 60 at SQL statement > > This happened when I was using a function to remove part of a comma > delimited string while updating a row. The update could potentially > touch every row in the table. The issue above occurred when a different > update function was being executed on the same table. The full content of containers_add_update() would be helpful as well as the content of the other function. If that is not possible some idea of the order in which they where run as well as where the LOCK TABLE below was inserted? > > If I use the following lock this issue seems to be resolved. However, > I'm not sure why the above issue occurred. > > LOCK TABLE containers IN SHARE ROW EXCLUSIVE MODE; > > Does anyone have any ideas? > > Thanks, > > Doug -- Adrian Klaver adrian.klaver@aklaver.com